feat(ci): sync issue assignees from PR closing refs and handle /take comments#4885
Conversation
…comments Renames auto-assign.yml to pr-assignment-triage.yml to reflect its expanded scope: in addition to PR self-assign and merge-time credit, it now mirrors the PR opener as an assignee on each same-repo issue listed in closingIssuesReferences and removes them when a closing keyword is dropped from the PR body. Triggers expand to include edited/reopened/ready_for_review, gated on PR open state and a non-bot opener so closed-PR edits and bot PRs do not churn issue state. Other manual assignees are never touched here, so this never fights with credit-issue-on-pr-merge or human triage decisions. Extends issue-triage.yml with a take-comment job that assigns the author of a /take comment on an issue. The startsWith filter at the job level keeps non-/take comments from allocating a runner; exact-match validation inside the script rejects suffixes like "/take this issue please". The triage label removal then falls out of the existing assigned-event handler. Closes apache#4884
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4885 +/- ##
============================================
+ Coverage 43.12% 43.28% +0.15%
- Complexity 2153 2218 +65
============================================
Files 914 985 +71
Lines 32196 37529 +5333
Branches 3253 4282 +1029
============================================
+ Hits 13886 16243 +2357
- Misses 17468 20122 +2654
- Partials 842 1164 +322
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ingle job The opened event already covers draft creation (drafts are opened PRs), and edited covers the body-change paths that ready_for_review and reopened would otherwise re-trigger redundantly. Trim the trigger list to opened/edited/closed. Collapse the three separate jobs into one job with step-level if guards. The PR Checks UI shows one job entry per workflow run rather than two-or-three skipped siblings, matching the actual semantic of "one PR triage cycle". Step-level skips remain visible in the run log but no longer create separate Check entries on the PR. Trade-off: a closed-without-merge event now allocates a runner that ends with all steps skipped (~10s of compute) instead of three job-level skips. This is rare relative to the typical PR lifecycle, and the cleaner UI on every other event outweighs it.
/take comments
There was a problem hiding this comment.
Pull request overview
Adds/extends GitHub Actions automation to keep issue assignment + triage labeling in sync with PR closing references and /take issue comments.
Changes:
- Replaces the old PR auto-assign workflow with a consolidated
pr-assignment.ymlthat self-assigns PR authors, syncs PR openers to same-repo closing issues, and keeps the existing “credit assignees on merge” behavior. - Extends
issue-triage.ymlto (a) addtriageon newly-opened unassigned issues and (b) implement/takecomment self-assignment for issues. - Removes the legacy
.github/workflows/auto-assign.ymlworkflow.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/pr-assignment.yml | New PR-target workflow that self-assigns PR authors, mirrors PR opener onto closing issues, and credits assignees on merge. |
| .github/workflows/issue-triage.yml | Adds opened and issue_comment.created handling to manage triage label and /take self-assignment. |
| .github/workflows/auto-assign.yml | Removes the prior workflow now superseded by pr-assignment.yml. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ut-merge
Two review-driven fixes for the PR-assignment workflow:
1. The body-diff regex used to detect removed closing references now
accepts the colon form ("Closes: apache#123") in addition to the bare
"closes apache#123" form. The behavior on multiple refs per line
("Closes #1, #2") is unchanged and matches `closingIssuesReferences`
semantics — only #1 is treated as a closing ref. Verified against 12
shape variants (uppercase/colon/multi-line/non-keyword).
2. New step: when a PR is closed without being merged, remove the opener
from each same-repo closing-reference issue. Previously, abandoned
PRs left the opener as a stale assignee with `triage` removed. The
issue-triage workflow's unassigned handler then re-adds `triage` if
no other assignees remain. Cross-repo refs are skipped, consistent
with the assign side. Bot-opened PRs are excluded.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…` comments (#4885) ### What changes were proposed in this PR? Adds three automation flows. By example (`#N`, `#M` are placeholders): **Example 1 — You open a PR with `Closes #N` in the body.** You are added as an assignee of issue `#N`, and `#N`'s `triage` label is removed (downstream of the existing assigned-event handler). Other assignees of `#N` (e.g. a maintainer) are not touched. **Example 2 — You then edit the PR body to drop `Closes #N`.** You are removed from issue `#N`'s assignees. If you were the only assignee, `triage` is added back. The detection uses `changes.body.from` plus a regex to find which closing references disappeared; `closingIssuesReferences` (GraphQL) only reflects the new state and is not enough on its own. **Example 3 — A contributor comments `/take` on issue `#M`.** The commenter is auto-assigned and `triage` is removed. Exact-line match: `/take this issue please` does not trigger. `/take` from a `[bot]` account is filtered at the job level. `/take` posted on a PR (vs an issue) is filtered by `issue.pull_request == null`. **Example 4 — A maintainer merges a PR.** Behavior unchanged. The existing `credit-issue-on-pr-merge` step overwrites issue assignees with the credited authors set (PR opener + commit authors, deduped, max 10, `[bot]` filtered). **Example 5 — A bare issue is created (no template, e.g., via API or migration).** The `triage` label is added automatically. Issues created via the existing templates (which already attach `labels: ["triage"]`) are unaffected — the workflow no-ops when the label is already there. Issues opened with an assignee pre-set (e.g., creator self-assigns at creation) skip this step so the assigned-event handler does not immediately remove the just-added label. `auto-assign.yml` is renamed to `pr-assignment.yml` (its scope now extends past pure PR self-assign). The 3 prior jobs are collapsed into 1 job with 3 step-level if-guards so the PR Checks UI shows one entry per PR event instead of 2-3 skipped siblings. ### Any related issues, documentation, discussions? Closes #4884 ### How was this PR tested? Static YAML parse via `python3 -c 'import yaml; yaml.safe_load(...)'`. End-to-end behavior is verified post-merge via the example scenarios above (each scenario is the manual reproduction step). ### Was this PR authored or co-authored using generative AI tooling? (backported from commit b16d0db) Generated-by: Claude Code (Opus 4.7)
|
Backport to |
What changes were proposed in this PR?
Adds three automation flows. By example (
#N,#Mare placeholders):Example 1 — You open a PR with
Closes #Nin the body.You are added as an assignee of issue
#N, and#N'striagelabel is removed (downstream of the existing assigned-event handler). Other assignees of#N(e.g. a maintainer) are not touched.Example 2 — You then edit the PR body to drop
Closes #N.You are removed from issue
#N's assignees. If you were the only assignee,triageis added back. The detection useschanges.body.fromplus a regex to find which closing references disappeared;closingIssuesReferences(GraphQL) only reflects the new state and is not enough on its own.Example 3 — A contributor comments
/takeon issue#M.The commenter is auto-assigned and
triageis removed. Exact-line match:/take this issue pleasedoes not trigger./takefrom a[bot]account is filtered at the job level./takeposted on a PR (vs an issue) is filtered byissue.pull_request == null.Example 4 — A maintainer merges a PR.
Behavior unchanged. The existing
credit-issue-on-pr-mergestep overwrites issue assignees with the credited authors set (PR opener + commit authors, deduped, max 10,[bot]filtered).Example 5 — A bare issue is created (no template, e.g., via API or migration).
The
triagelabel is added automatically. Issues created via the existing templates (which already attachlabels: ["triage"]) are unaffected — the workflow no-ops when the label is already there. Issues opened with an assignee pre-set (e.g., creator self-assigns at creation) skip this step so the assigned-event handler does not immediately remove the just-added label.auto-assign.ymlis renamed topr-assignment.yml(its scope now extends past pure PR self-assign). The 3 prior jobs are collapsed into 1 job with 3 step-level if-guards so the PR Checks UI shows one entry per PR event instead of 2-3 skipped siblings.Any related issues, documentation, discussions?
Closes #4884
How was this PR tested?
Static YAML parse via
python3 -c 'import yaml; yaml.safe_load(...)'. End-to-end behavior is verified post-merge via the example scenarios above (each scenario is the manual reproduction step).Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.7)