feat(ci): label PR review state via slash commands and lifecycle#3231
Open
feat(ci): label PR review state via slash commands and lifecycle#3231
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3231 +/- ##
============================================
- Coverage 74.45% 74.43% -0.03%
Complexity 943 943
============================================
Files 1188 1188
Lines 106543 106543
Branches 83560 83578 +18
============================================
- Hits 79330 79301 -29
+ Misses 24464 24462 -2
- Partials 2749 2780 +31
🚀 New features to boost your workflow:
|
Reviewers cannot tell at a glance which open PRs are still in their
queue. Iggy's .asf.yaml requires 2 approvals with stale-dismiss, so
each push wipes prior approvals - the review backlog grows opaque
fast as PR volume rises.
Adopt rust-lang/triagebot's S-waiting-on-{review,author} pattern via
a single GitHub Actions workflow. Comment commands /ready, /author,
and /request-review @user move the labels explicitly; PR lifecycle
events (open, ready_for_review, converted_to_draft, closed) keep
them in sync without manual upkeep. Filter the queue with
`is:open is:pr label:S-waiting-on-review`.
The auth gate is author_association in {COLLABORATOR, OWNER}, which
matches @apache/iggy-committers. MEMBER is excluded deliberately -
it would admit any unrelated apache podling member.
issue_comment.created and pull_request_target are the only triggers;
the workflow never checks out a ref or executes PR-supplied code,
only calls the REST API via actions/github-script. This avoids the
pwn-request RCE class and stays inside the default GITHUB_TOKEN
scope - no PAT, no INFRA Jira ticket, no external host.
CODEOWNERS gains a `* @apache/iggy-committers` wildcard so reviewer
auto-request fires on every PR, not just .github/** changes.
mmodzelewski
approved these changes
May 9, 2026
lukaszzborek
reviewed
May 9, 2026
Comment on lines
+259
to
+291
| if (!sawReassign) { | ||
| // GH username: alnum + hyphen, no leading/trailing | ||
| // hyphen. Optional team slug: '/' then alnum + underscore | ||
| // + hyphen. Anchored \s*$ rejects trailing junk on the | ||
| // line, preventing silent truncation of @foo/bar/baz or | ||
| // empty slugs like @foo/. | ||
| const m = line.match(/^\/request-review\s+@([A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?(?:\/[A-Za-z0-9_-]+)?)\s*$/); | ||
| if (m) { | ||
| sawReassign = true; | ||
| if (!(isCommitter || isPrAuthor)) { | ||
| core.info(`/request-review: ignored, ${commentAuthor} lacks permission`); | ||
| } else { | ||
| const reviewer = m[1]; | ||
| const isTeam = reviewer.includes('/'); | ||
| const params = { | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: prNumber, | ||
| }; | ||
| if (isTeam) { | ||
| // Team slugs go through team_reviewers as bare slug, no org. | ||
| params.team_reviewers = [reviewer.split('/')[1]]; | ||
| } else { | ||
| params.reviewers = [reviewer]; | ||
| } | ||
| try { | ||
| await github.rest.pulls.requestReviewers(params); | ||
| core.info(`/request-review: requested ${reviewer}`); | ||
| } catch (e) { | ||
| core.warning(`/request-review: failed for ${reviewer}: ${e.message}`); | ||
| } | ||
| } | ||
| continue; |
Contributor
There was a problem hiding this comment.
for multi /request-review in single comment it should add only first one as reviewer?
Now it's set sawReassign as true, so next line will be ignore from adding next reviewer.
maybe it should be /request-review @abcd @ddddd
or first go through all lines and at end call api to add reviewers, sets labels
or stay as is, all receive notification from comments
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reviewers cannot tell at a glance which open PRs are still in their
queue. Iggy's .asf.yaml requires 2 approvals with stale-dismiss, so
each push wipes prior approvals - the review backlog grows opaque
fast as PR volume rises.
Adopt rust-lang/triagebot's S-waiting-on-{review,author} pattern via
a single GitHub Actions workflow. Comment commands /ready, /author,
and /request-review @user move the labels explicitly; PR lifecycle
events (open, ready_for_review, converted_to_draft, closed) keep
them in sync without manual upkeep. Filter the queue with
is:open is:pr label:S-waiting-on-review.The auth gate is author_association in {COLLABORATOR, OWNER}, which
matches @apache/iggy-committers. MEMBER is excluded deliberately -
it would admit any unrelated apache podling member.
issue_comment.created and pull_request_target are the only triggers;
the workflow never checks out a ref or executes PR-supplied code,
only calls the REST API via actions/github-script. This avoids the
pwn-request RCE class and stays inside the default GITHUB_TOKEN
scope - no PAT, no INFRA Jira ticket, no external host.
CODEOWNERS gains a
* @apache/iggy-committerswildcard so reviewerauto-request fires on every PR, not just .github/** changes.