-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ci(triage): re-triage issues when needs-info is cleared #4108
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
Merged
+156
−12
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Clear needs-info on author response | ||
|
|
||
| # When the issue AUTHOR comments on an issue that carries `needs-info`, remove | ||
| # the label — the reporter has (presumably) supplied the missing detail. That | ||
| # removal is the signal the rest of the pipeline is built around: | ||
| # | ||
| # author comments -> this workflow removes `needs-info` | ||
| # -> issue-triage.yml's `unlabeled` trigger re-triages | ||
| # (reads the follow-up comments, classifies + assigns, | ||
| # or re-adds `needs-info` if it is still too vague) | ||
| # author never responds -> stale.yml closes the issue after inactivity | ||
| # | ||
| # CRITICAL: the label MUST be removed with the omnigent-ci App token, not the | ||
| # default GITHUB_TOKEN. GitHub does not re-trigger workflows from events made | ||
| # by GITHUB_TOKEN, so a default-token removal would NOT fire issue-triage's | ||
| # `unlabeled` re-triage. The App token is a distinct actor, so its `unlabeled` | ||
| # event does re-trigger. If the App isn't configured, we skip (fail-closed): | ||
| # leaving the label is safer than removing it and stranding the issue. | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: needs-info-response-${{ github.event.issue.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| clear-needs-info: | ||
| runs-on: ubuntu-latest | ||
| # Only when a NON-bot commenter who IS the issue author comments on an OPEN | ||
| # issue (not a PR — issue_comment fires for PRs too) that still carries | ||
| # `needs-info`. | ||
| if: >- | ||
| !endsWith(github.event.sender.login, '[bot]') && | ||
| !github.event.issue.pull_request && | ||
| github.event.issue.state == 'open' && | ||
| github.event.comment.user.login == github.event.issue.user.login && | ||
| contains(github.event.issue.labels.*.name, 'needs-info') | ||
| steps: | ||
| - name: Mint omnigent-ci App token | ||
| id: app-token | ||
| if: vars.OMNIGENT_BOT_APP_ID != '' | ||
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | ||
| with: | ||
| app-id: ${{ vars.OMNIGENT_BOT_APP_ID }} | ||
| private-key: ${{ secrets.OMNIGENT_BOT_APP_KEY }} | ||
|
|
||
| - name: Remove needs-info label | ||
| # Skip when the App isn't configured: removing with GITHUB_TOKEN would | ||
| # not re-trigger re-triage, so the label would just silently vanish. | ||
| if: steps.app-token.outputs.token != '' | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| REPO: ${{ github.repository }} | ||
| ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
| run: | | ||
| set -euo pipefail | ||
| echo "Author responded on #$ISSUE_NUMBER; removing needs-info to re-triage." | ||
| gh issue edit "$ISSUE_NUMBER" --repo "$REPO" --remove-label needs-info | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Good catch — fixed in bc04dc5. The removal step now re-checks the live labels (
gh issue view --json labels | grep -qx needs-info) before calling--remove-label, so a stale event payload or a race (two quick comments / concurrent removal) no-ops cleanly instead of erroring. Also added a::notice::when the App is unconfigured, and suppressed theduplicatelabel (not just the comment) on the re-triage path per Polly's note.