-
Notifications
You must be signed in to change notification settings - Fork 480
Add GitHub Actions for Issue Management #140
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
Conversation
Introduces multiple workflow files to automate issue and PR triage, labeling, commenting, and closing. Includes actions for handling invalid issues/PRs, single-word issues, feature requests, stale issues, lack of response, and label management to streamline repository maintenance.
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.
Pull Request Overview
This PR introduces automated GitHub Actions workflows for comprehensive issue and pull request management, implementing triage automation, labeling, and lifecycle management to reduce manual repository maintenance overhead.
- Automated triage labeling for new issues with smart label management
- Automated responses and actions for specific issue states (unable-to-reproduce, enhancement, invalid)
- Automated closure of spam and invalid issues with appropriate messaging
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/triage-issues.yml | Automatically adds triage labels to new/reopened issues and re-adds when more-info-needed is removed |
| .github/workflows/remove-triage-label.yml | Removes triage label when other labels are applied (except more-info-needed) |
| .github/workflows/on-issue-close.yml | Cleans up triage labels when issues are closed |
| .github/workflows/unable-to-reproduce-comment.yml | Adds standardized comment and more-info-needed label for unable-to-reproduce issues |
| .github/workflows/feature-request-comment.yml | Adds backlog notification comment for enhancement-labeled issues |
| .github/workflows/no-response.yml | Automatically closes issues with more-info-needed label after 7 days of no response |
| .github/workflows/stale-issues.yml | Marks issues as stale after 365 days but doesn't auto-close them |
| .github/workflows/close-single-word-issues.yml | Automatically closes issues with single-word titles as spam |
| .github/workflows/close-invalid.yml | Automatically closes issues/PRs when labeled as invalid |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
OSPO License Check.. Workflows cannot be required from a less visible repository... hmm. |
andyfeller
left a comment
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.
Nothing blocking, but had some ideas to enhance the experience and maintainability 🙇
| on: | ||
| issues: | ||
| types: [labeled] |
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.
question: is it worth consolidating labeled workflows?
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.
Possibly.. I kind of like the organization of separate .ymls for separate purposes... but not sure if that sacrifices anything action runner wise.
| on: | ||
| issues: | ||
| types: [labeled] |
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.
question: doesn't this need the pull_request_target event to handle PRs?
| on: | |
| issues: | |
| types: [labeled] | |
| on: | |
| issues: | |
| types: [labeled] | |
| pull_request_target: | |
| types: [labeled] | |
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: gh issue close ${{ github.event.issue.html_url }} |
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.
suggest: use intermediate variables to avoid interpolating context in run blocks
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh issue close ${{ github.event.issue.html_url }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| URL: ${{ github.event.issue.html_url }} | |
| run: gh issue close $URL |
| steps: | ||
| - run: gh issue edit "$NUMBER" --add-label "$LABELS" | ||
| - run: gh issue comment "$NUMBER" --body "$BODY" |
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.
nit: consolidating these runs into a single step with a name and moving the env from the job to the step would make this easier to maintain
| steps: | |
| - run: gh issue edit "$NUMBER" --add-label "$LABELS" | |
| - run: gh issue comment "$NUMBER" --body "$BODY" | |
| steps: | |
| - name: Update issue | |
| run: | | |
| gh issue edit "$NUMBER" --add-label "$LABELS" | |
| gh issue comment "$NUMBER" --body "$BODY" |
| - name: Close Single-Word Issue | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const issueTitle = context.payload.issue.title.trim(); | ||
| const isSingleWord = /^\S+$/.test(issueTitle); | ||
|
|
||
| if (isSingleWord) { | ||
| const issueNumber = context.payload.issue.number; | ||
| const repo = context.repo.repo; | ||
|
|
||
| // Close the issue and add the invalid label | ||
| github.rest.issues.update({ | ||
| owner: context.repo.owner, | ||
| repo: repo, | ||
| issue_number: issueNumber, | ||
| labels: ['invalid'], | ||
| state: 'closed' | ||
| }); | ||
|
|
||
| // Comment on the issue | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: repo, | ||
| issue_number: issueNumber, | ||
| body: `This issue may have been opened accidentally. I'm going to close it now, but feel free to open a new issue with a more descriptive title.` | ||
| }); | ||
| } |
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.
thought: this might be an opportunity to utilize https://github.com/github/ai-moderator for detecting spam like this 🤔
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.
Interesting - Sounds like a neat potential iteration.
| noResponse: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: lee-dohm/no-response@v0.5.0 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| closeComment: > | ||
| Thank you for your issue! | ||
|
|
||
| We haven’t gotten a response to our questions above. With only the | ||
| information that is currently in the issue, we don’t have enough | ||
| information to take action. We’re going to close this but don’t | ||
| hesitate to reach out if you have or find the answers we need. If | ||
| you answer our questions above, this issue will automatically | ||
| reopen. | ||
| daysUntilClose: 7 |
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.
thought: I would have imaged the actions/stale would provide support for this 🤔
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.
Might be able to use it for the same thing. We implemented lee-dohm/no-response quite a bit (like years) before actions/stale was a thing and simply didn't look to change what wasn't broken. :D
Looks to me like actions/stale does have "only-labels" which would likely allow you to accomplish the same goal in conjunction to the same "more-info-needed" label as well as a 'close-issue-message"
Introduces multiple workflow files to automate issue and PR triage, labeling, commenting, and closing. Includes actions for handling invalid issues/PRs, single-word issues, feature requests, stale issues, lack of response, and label management to streamline repository maintenance.
It will: