Skip to content

feat(ci): label PR review state via slash commands and lifecycle#3231

Open
hubcio wants to merge 1 commit intomasterfrom
feat/pr-triage-bot
Open

feat(ci): label PR review state via slash commands and lifecycle#3231
hubcio wants to merge 1 commit intomasterfrom
feat/pr-triage-bot

Conversation

@hubcio
Copy link
Copy Markdown
Contributor

@hubcio hubcio commented May 9, 2026

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.43%. Comparing base (0928f13) to head (05e5279).

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     
Components Coverage Δ
Rust Core 75.70% <ø> (ø)
Java SDK 60.14% <ø> (ø)
C# SDK 69.13% <ø> (-0.31%) ⬇️
Python SDK 81.43% <ø> (ø)
Node SDK 91.40% <ø> (-0.14%) ⬇️
Go SDK 39.80% <ø> (ø)
see 29 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hubcio hubcio force-pushed the feat/pr-triage-bot branch from cad6096 to 2c74fff Compare May 9, 2026 12:26
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.
@hubcio hubcio force-pushed the feat/pr-triage-bot branch from 2c74fff to 05e5279 Compare May 9, 2026 13:34
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;
Copy link
Copy Markdown
Contributor

@lukaszzborek lukaszzborek May 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants