-
Notifications
You must be signed in to change notification settings - Fork 53
Add scheduled auto-closure for stale “Needs Author Feedback” issues #566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c0aa170
b0f8f5b
38d6284
377f9f7
f5da288
f0679c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,63 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Close inactive author feedback issues | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| schedule: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - cron: "0 9 * * *" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| issues: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| close-inactive: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Close issues waiting on author feedback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/github-script@v7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const label = "Needs Author Feedback"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const label = "Needs Author Feedback"; | |
| const label = "Needs: Author Feedback"; |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 7-day inactivity period conflicts with the existing policy timing. The current resourceManagement.yml policy uses a 7-day total process: adds a warning comment after 4 days of inactivity, then closes after 3 more days. This provides users with advance notice. The new workflow closes issues immediately after 7 days without prior warning. Consider aligning with the existing two-stage approach to provide better user experience, or clearly document why a different approach is needed.
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow retrieves all open issues with the label and filters them in memory. For repositories with many issues, this could be inefficient. Consider adding the 'since' parameter to the API call to filter issues at the API level based on the cutoff date, reducing the amount of data transferred and processed.
| direction: "asc", | |
| direction: "asc", | |
| since: cutoff.toISOString(), |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The closing message should match the established tone and format used in the existing policy. The current resourceManagement.yml uses a more formal message structure that includes markdown formatting for emphasis. Consider using a message consistent with the existing policy's style.
| "We haven't heard back in 7 days, so we're automatically closing this issue.", | |
| "If you still need help, please reply and we can reopen it." | |
| "**This issue has been automatically closed due to lack of author feedback after 7 days.**", | |
| "", | |
| "If you still require assistance, please comment on this issue and we will be happy to reopen it." |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the issue closure fails but the comment was successfully posted, the issue will remain open with a closure notice that's inaccurate. The existing resourceManagement.yml policy handles this atomically through its action system. Consider adding a state check or removing the comment if closure fails to maintain consistency between the comment message and actual issue state.
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow duplicates functionality already handled by the existing GitOps policy in .github/policies/resourceManagement.yml (lines 11-43). The existing policy already closes issues with "Needs: Author Feedback" label after 7 days of inactivity (4 days for warning + 3 days to close). Having two separate systems managing the same process creates potential conflicts, confusion, and maintenance overhead. Consider whether this workflow is necessary, or if the existing policy should be modified instead.
| name: Close inactive author feedback issues | |
| on: | |
| schedule: | |
| - cron: "0 9 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| close-inactive: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Close issues waiting on author feedback | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const label = "Needs Author Feedback"; | |
| const daysInactive = 7; | |
| const cutoff = new Date(Date.now() - daysInactive * 24 * 60 * 60 * 1000); | |
| const { owner, repo } = context.repo; | |
| const issues = await github.paginate(github.rest.issues.listForRepo, { | |
| owner, | |
| repo, | |
| state: "open", | |
| labels: label, | |
| per_page: 100, | |
| sort: "updated", | |
| direction: "asc", | |
| }); | |
| for (const issue of issues) { | |
| if (issue.pull_request) { | |
| continue; | |
| } | |
| const updatedAt = new Date(issue.updated_at); | |
| if (updatedAt > cutoff) { | |
| continue; | |
| } | |
| const body = [ | |
| "We haven't heard back in 7 days, so we're automatically closing this issue.", | |
| "If you still need help, please reply and we can reopen it." | |
| ].join("\n\n"); | |
| try { | |
| await github.rest.issues.createComment({ owner, repo, issue_number: issue.number, body }); | |
| } catch (error) { | |
| console.warn(`Skipping issue #${issue.number} because of an error while adding the notice: ${error}`); | |
| continue; | |
| } | |
| try { | |
| await github.rest.issues.update({ owner, repo, issue_number: issue.number, state: "closed" }); | |
| } catch (error) { | |
| console.warn(`Skipping issue #${issue.number} because of an error while processing closure: ${error}`); | |
| } | |
| } | |
| # (File deleted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow_dispatch trigger should have empty braces for consistency with the codeQL.yml workflow in this repository (line 15), which uses explicit empty object notation. Update to 'workflow_dispatch: {}' for consistency.