[PR #57] [MERGED] feat(assign-reviewers): skip auto-assign when the PR already has a non-author assignee (BE-4008) #66

Closed
opened 2026-10-26 22:35:52 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/github-workflows/pull/57
Author: @mattmillerai
Created: 7/22/2026
Status: ✅ Merged
Merged: 7/22/2026
Merged by: @mattmillerai

Base: main ← Head: matt/be-4008-skip-if-non-author-assignee


📝 Commits (2)

  • de1e7cc feat(assign-reviewers): skip auto-assign when a non-author assignee is already set (BE-4008)
  • d474425 fix(assign-reviewers): skip on unreadable live state + re-check before assigning (BE-4008)

📊 Changes

1 file changed (+51 additions, -2 deletions)

View changed files

📝 .github/workflows/assign-reviewers.yml (+51 -2)

📄 Description

ELI-5

When you open a PR, a bot normally picks reviewers for you and puts them in the
Assignee field (this org alerts people via assignees). But if you already
picked someone yourself — say you assigned a specific reviewer when you created
the PR — the bot was rudely piling its own picks on top of yours. This change
teaches the bot to look before it leaps: if a real person (anyone other than you,
the author) is already assigned, the bot leaves your choice alone and adds
nothing. If no one is assigned yet — or only you are assigned — the bot still
does its normal expertise-based pick.

What & why

assign-reviewers.yml skipped only when pr.assignees from the trigger
payload
was non-empty. Two problems, both fixed here:

  1. The payload is stale. An assignee set at PR creation time isn't reliably
    in the opened event payload, so the old check missed it and the bot stacked
    its picks on top of an already-assigned PR (observed on a real cloud PR — the
    auto-assigner added 2 assignees to a PR that already had one). Now the check
    reads the PR's current assignees live from the API (pulls.get), so a
    creation-time assignee is honored.
  2. Author-only assignment shouldn't block the pick. The old check skipped on
    any assignee, including the author. Now only a non-author assignee causes
    a skip; a PR assigned only to its author (e.g. by assign-prs-to-author.yml)
    still gets the blame-based auto-pick.

Acceptance criteria

  • A PR with a non-author assignee when the action runs receives no bot
    assignment (early return before the assign step).
  • A PR with no assignee, or only the author assigned, still gets the
    blame-based auto-assign (author is filtered out of the check).
  • The check reads live assignees at run time (github.rest.pulls.get),
    honoring an assignee set at PR creation.

Notes / judgment calls

  • Chesterton's Fence: this refines a one-day-old check (added 2026-07-20 in
    #41). This ticket, filed the next day, explicitly asks for the non-author +
    live-read behavior, so the change to that check is intended, not an accidental
    broadening.
  • Out of scope (honored): no per-PR single-assignee cap — multiple bot picks
    remain intentional for load-spread. The existing skip-auto-assign label
    opt-out is untouched; this adds the automatic behavior alongside it.
  • Fail-safe: the live read is wrapped in try/catch and falls back to the
    payload assignees on API error, still applying the non-author filter — it never
    fails the PR (consistent with the workflow's existing "never fail the PR" exits).
  • No capability denied to users: the added skip only stops the bot from
    overriding a human's manual assignment; contributors keep full ability to
    assign anyone. (Not a capability-denial change — nothing to falsify.)

Testing

  • python3 YAML parse of the workflow + node --check on the extracted
    github-script body — both pass.
  • This repo has no unit-test harness for inline github-script JS (per AGENTS.md
    only the Python/shell/Go helper scripts are tested); no such test was added, in
    keeping with the repo's structure. The change is a ~21-line, self-contained
    early-exit guard.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/github-workflows/pull/57 **Author:** [@mattmillerai](https://github.com/mattmillerai) **Created:** 7/22/2026 **Status:** ✅ Merged **Merged:** 7/22/2026 **Merged by:** [@mattmillerai](https://github.com/mattmillerai) **Base:** `main` ← **Head:** `matt/be-4008-skip-if-non-author-assignee` --- ### 📝 Commits (2) - [`de1e7cc`](https://github.com/Comfy-Org/github-workflows/commit/de1e7ccfdabc28f8567788b86e9f627c236ce26d) feat(assign-reviewers): skip auto-assign when a non-author assignee is already set (BE-4008) - [`d474425`](https://github.com/Comfy-Org/github-workflows/commit/d474425930cf51bd7e017f60655875b310a24ff9) fix(assign-reviewers): skip on unreadable live state + re-check before assigning (BE-4008) ### 📊 Changes **1 file changed** (+51 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/assign-reviewers.yml` (+51 -2) </details> ### 📄 Description ## ELI-5 When you open a PR, a bot normally picks reviewers for you and puts them in the **Assignee** field (this org alerts people via assignees). But if you *already* picked someone yourself — say you assigned a specific reviewer when you created the PR — the bot was rudely piling its own picks on top of yours. This change teaches the bot to look before it leaps: if a real person (anyone other than you, the author) is already assigned, the bot leaves your choice alone and adds nothing. If no one is assigned yet — or only *you* are assigned — the bot still does its normal expertise-based pick. ## What & why `assign-reviewers.yml` skipped only when `pr.assignees` from the **trigger payload** was non-empty. Two problems, both fixed here: 1. **The payload is stale.** An assignee set at PR *creation* time isn't reliably in the `opened` event payload, so the old check missed it and the bot stacked its picks on top of an already-assigned PR (observed on a real cloud PR — the auto-assigner added 2 assignees to a PR that already had one). Now the check reads the PR's **current assignees live from the API** (`pulls.get`), so a creation-time assignee is honored. 2. **Author-only assignment shouldn't block the pick.** The old check skipped on *any* assignee, including the author. Now only a **non-author** assignee causes a skip; a PR assigned only to its author (e.g. by `assign-prs-to-author.yml`) still gets the blame-based auto-pick. ## Acceptance criteria - [x] A PR with a non-author assignee when the action runs receives **no** bot assignment (early `return` before the assign step). - [x] A PR with no assignee, or only the author assigned, still gets the blame-based auto-assign (author is filtered out of the check). - [x] The check reads **live** assignees at run time (`github.rest.pulls.get`), honoring an assignee set at PR creation. ## Notes / judgment calls - **Chesterton's Fence:** this refines a one-day-old check (added 2026-07-20 in #41). This ticket, filed the next day, explicitly asks for the non-author + live-read behavior, so the change to that check is intended, not an accidental broadening. - **Out of scope (honored):** no per-PR single-assignee cap — multiple bot picks remain intentional for load-spread. The existing `skip-auto-assign` label opt-out is untouched; this adds the automatic behavior alongside it. - **Fail-safe:** the live read is wrapped in try/catch and falls back to the payload assignees on API error, still applying the non-author filter — it never fails the PR (consistent with the workflow's existing "never fail the PR" exits). - **No capability denied to users:** the added skip only stops the *bot* from overriding a human's manual assignment; contributors keep full ability to assign anyone. (Not a capability-denial change — nothing to falsify.) ## Testing - `python3` YAML parse of the workflow + `node --check` on the extracted `github-script` body — both pass. - This repo has no unit-test harness for inline `github-script` JS (per AGENTS.md only the Python/shell/Go helper scripts are tested); no such test was added, in keeping with the repo's structure. The change is a ~21-line, self-contained early-exit guard. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:35:52 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/github-workflows#66
No description provided.