feat(add-workflow): update-closed-issues#534
Conversation
Signed-off-by: Tripura Repalle <tripura@blinklabs.io>
📝 WalkthroughWalkthroughTwo GitHub Actions workflows are added to automate actions on issue closure. The first workflow, "Test Issue Close Trigger," outputs the closed issue number and title to confirm trigger functionality. The second workflow, "Set Project Closed Date," computes a closed date from the issue's closed_at timestamp or uses the current UTC date, formats it as YYYY-MM-DD, and updates a project board field named "Closed Date" with this value. Both workflows are triggered by closed issue events. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/update-issue-on-close.yml (1)
7-9: Permissions may be insufficient for project board updates.The workflow has
contents: readandissues: readpermissions, but updating a GitHub Projects v2 board typically requiresrepository-projects: writepermission. Since you're using a PAT (ORG_PROJECT_PAT) which likely has broader permissions, this may work, but if you ever switch toGITHUB_TOKEN, ensure the permissions are sufficient.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/update-issue-on-close.yml around lines 7 - 9, The workflow currently sets permissions: contents: read and issues: read which are insufficient for updating a GitHub Projects v2 board; update the permissions block to include repository-projects: write (or at least repository-projects: write when using GITHUB_TOKEN) and ensure the secret ORG_PROJECT_PAT is scoped appropriately—modify the permissions keys (contents, issues, repository-projects) in the YAML so repository-projects has write access and validate behavior with both ORG_PROJECT_PAT and GITHUB_TOKEN..github/workflows/test-issue-on-close.yml (1)
1-19: Consider removing this test workflow before merging.This workflow appears to be a debugging/test workflow to verify issue close triggers work correctly. If this was created solely for testing purposes, consider removing it before merging to avoid unnecessary workflow runs on every issue closure.
If intentionally kept for observability, the implementation is sound—using environment variables to pass context values safely avoids shell injection risks.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/test-issue-on-close.yml around lines 1 - 19, This workflow ("Test Issue Close Trigger") is a test/debug workflow that triggers on issue closures (on: issues: types: [closed]); if it was only created for testing, delete this workflow file to avoid running on every issue close, otherwise restrict or disable it (for example, replace the issue trigger with a manual trigger like workflow_dispatch or add conditional filters to limit which issues trigger it) and keep the env/echo steps as-is if you intend to retain observability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/update-issue-on-close.yml:
- Around line 22-30: The script is directly interpolating
github.event.issue.closed_at into the shell (ts='${{
github.event.issue.closed_at }}'); change this to pass the value via an
environment variable instead and read that env var in the shell to avoid direct
interpolation. Update the workflow step to set an env entry (e.g., CLOSED_AT:
${{ github.event.issue.closed_at }}) and then in the script use ts="$CLOSED_AT"
(or similar) when computing d and writing GITHUB_OUTPUT, keeping the existing
logic around null/empty and date formatting intact.
---
Nitpick comments:
In @.github/workflows/test-issue-on-close.yml:
- Around line 1-19: This workflow ("Test Issue Close Trigger") is a test/debug
workflow that triggers on issue closures (on: issues: types: [closed]); if it
was only created for testing, delete this workflow file to avoid running on
every issue close, otherwise restrict or disable it (for example, replace the
issue trigger with a manual trigger like workflow_dispatch or add conditional
filters to limit which issues trigger it) and keep the env/echo steps as-is if
you intend to retain observability.
In @.github/workflows/update-issue-on-close.yml:
- Around line 7-9: The workflow currently sets permissions: contents: read and
issues: read which are insufficient for updating a GitHub Projects v2 board;
update the permissions block to include repository-projects: write (or at least
repository-projects: write when using GITHUB_TOKEN) and ensure the secret
ORG_PROJECT_PAT is scoped appropriately—modify the permissions keys (contents,
issues, repository-projects) in the YAML so repository-projects has write access
and validate behavior with both ORG_PROJECT_PAT and GITHUB_TOKEN.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/test-issue-on-close.yml.github/workflows/update-issue-on-close.yml
Signed-off-by: Tripura Repalle <tripura@blinklabs.io>
Summary by cubic
Adds two GitHub Actions that run when an issue is closed. One confirms the trigger, and the other sets the “Closed Date” on our Project (v2) item.
New Features
Migration
Written for commit a14175a. Summary will update on new commits.
Summary by CodeRabbit