Skip to content

ci: auto-assign PR author on open#328

Open
lockwobr wants to merge 2 commits into
mainfrom
feat/auto-assign-author
Open

ci: auto-assign PR author on open#328
lockwobr wants to merge 2 commits into
mainfrom
feat/auto-assign-author

Conversation

@lockwobr

Copy link
Copy Markdown
Collaborator

What

Adds an Auto-Assign PR Author workflow that assigns the author to their own PR when it is opened, so every PR has a clear owner from the start.

Why

Complements the existing self-service assign.yaml (/assign): rather than requiring a manual claim, the author is set automatically on open. They (or a maintainer) can still reassign with /assign @user or /unassign.

Design notes

  • Skips bots (Dependabot, etc.) — they aren't assignable and it would just be noise.
  • Respects an existing assignee set at open time (no-op if one is already present).
  • Reports non-assignable authors: addAssignees silently drops users without repo access, so the workflow logs a warning if the author couldn't be assigned.
  • Uses pull_request_target so it also works for fork PRs (the read-only pull_request token can't assign). This is safe: the job never checks out or executes PR code — it only calls the assignee API with the event payload.
  • github-script pinned to the same SHA used by the other workflows.

@lockwobr
lockwobr requested a review from a team July 17, 2026 21:26
@github-actions github-actions Bot added component/operator Skyhook operator (controller-manager) component/ci CI workflows, GitHub Actions, and repo tooling labels Jul 17, 2026
@lockwobr lockwobr self-assigned this Jul 17, 2026
@lockwobr
lockwobr enabled auto-merge (squash) July 17, 2026 21:26
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an Auto-Assign PR Author GitHub Actions workflow triggered when a pull request is opened. It uses pull_request_target without checking out or executing pull request code, coordinates assignee updates with the existing assignment workflow, and assigns eligible authors through the Issues API while skipping bots and already-assigned pull requests.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • NVIDIA/nodewright#320: Updates the assignment workflow whose assignee mutations now share concurrency with this workflow.

Suggested reviewers: ayuskauskas

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: automatically assigning the PR author when a PR opens.
Description check ✅ Passed The description accurately describes the new auto-assign workflow and its supporting concurrency and permission details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auto-assign-author

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/auto-assign-author.yaml:
- Around line 42-46: Remove the pull-requests: write permission from the
workflow permissions block. Keep issues: write unchanged, since the auto-assign
job uses github.rest.issues.addAssignees(...) for this operation.
- Around line 62-73: Before the github.rest.issues.addAssignees call in the
workflow’s assignment logic, fetch the issue’s current assignees from the live
API and skip assignment when any are present. Use the live response for the
preservation check instead of relying on pr.assignees from the opened event
snapshot, while retaining the existing author assignment behavior when no
assignees exist.
- Around line 68-77: Wrap the addAssignees call and its non-assignable-user
check in try/catch within the workflow step. In the catch handler, issue a
core.warning that includes the PR number and author, then rethrow the error or
explicitly preserve best-effort behavior according to the step’s intended
contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 04446222-4458-4d0b-96e2-054d2e2e694a

📥 Commits

Reviewing files that changed from the base of the PR and between 859fc7d and 4993e33.

📒 Files selected for processing (1)
  • .github/workflows/auto-assign-author.yaml

Comment thread .github/workflows/auto-assign-author.yaml Outdated
Comment thread .github/workflows/auto-assign-author.yaml Outdated
Comment thread .github/workflows/auto-assign-author.yaml Outdated
@lockwobr
lockwobr force-pushed the feat/auto-assign-author branch 2 times, most recently from 5b91369 to bb27c9a Compare July 17, 2026 21:57
@lockwobr

Copy link
Copy Markdown
Collaborator Author

Addressed all three:

  • Permissions: dropped pull-requests: write; the job only calls issues.addAssignees, so issues: write alone is sufficient.
  • Live assignees: now re-reads assignees via issues.get immediately before assigning, instead of trusting the opened payload snapshot, so a manual /assign made right at open is respected.
  • Failure handling: the addAssignees call is wrapped in try/catch and logs a warning on rejection (best-effort).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/auto-assign-author.yaml:
- Around line 33-35: Update the concurrency group in the auto-assign workflow
and the corresponding configuration in assign.yaml to use the same PR-assignment
group prefix, while retaining each workflow’s appropriate event number
expression (including github.event.issue.number in assign.yaml), so both
workflows serialize per issue or pull request.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 2165b47e-30cd-4d3b-8140-1fb35bb1959c

📥 Commits

Reviewing files that changed from the base of the PR and between 5b91369 and bb27c9a.

📒 Files selected for processing (1)
  • .github/workflows/auto-assign-author.yaml

Comment thread .github/workflows/auto-assign-author.yaml
rice-riley
rice-riley previously approved these changes Jul 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/assign.yaml:
- Around line 43-46: Update .github/workflows/assign.yaml lines 43-46 and its
trigger condition around the “Issues only” comment to allow assignment commands
on pull-request comments while retaining the shared concurrency group. In
.github/workflows/auto-assign-author.yaml lines 17-18, preserve the handoff
claim only after PR comments are accepted; lines 33-35 require no direct change
because the shared concurrency group will provide the intended serialization.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: c35c17b3-27ae-4b97-b75f-b9186854224e

📥 Commits

Reviewing files that changed from the base of the PR and between bb27c9a and 8df226f.

📒 Files selected for processing (2)
  • .github/workflows/assign.yaml
  • .github/workflows/auto-assign-author.yaml

Comment thread .github/workflows/assign.yaml Outdated
@lockwobr

Copy link
Copy Markdown
Collaborator Author

Addressed: both assignment workflows now share one concurrency group (pr-assignment-<number>) so /assign (assign.yaml) and this auto-assign job serialize per PR and can't race between the read and write of the assignee list. This PR updates assign.yaml too for that reason.

(The same fix for the packages repo landed separately in NVIDIA/nodewright-packages#105, since its auto-assign PR had already merged.)

@lockwobr
lockwobr force-pushed the feat/auto-assign-author branch from b75cf0f to b1e975b Compare July 17, 2026 22:25
@lockwobr

Copy link
Copy Markdown
Collaborator Author

Good catch — this exposes that the earlier concurrency finding rested on a false premise. assign.yaml gates on !github.event.issue.pull_request, so /assign runs on issues only, never PRs. Since auto-assign-author is PR-only and /assign is issue-only, they operate on disjoint targets and can't race.

So I've reverted the coupling rather than expand /assign to PRs (a deliberate product call to keep the two independent): assign.yaml is untouched again, auto-assign-author keeps its own concurrency group, and the misleading '/assign handoff' comment is corrected to point at the GitHub UI. This PR now changes only auto-assign-author.yaml.

Add a workflow that assigns the author to their own PR when it is opened, so
every PR has a clear owner. Bots and PRs already assigned are skipped.
Contributors can still reassign with /assign. Uses pull_request_target so it
also works for fork PRs; the job never checks out or runs PR code.

Signed-off-by: Brian Lockwood <lockwobr@gmail.com>
@lockwobr
lockwobr force-pushed the feat/auto-assign-author branch from b1e975b to b3dd0ed Compare July 17, 2026 22:27
lockwobr added a commit to NVIDIA/nodewright-packages that referenced this pull request Jul 17, 2026
## What

Corrects the header comment in `auto-assign-author.yaml`. It claimed
contributors can hand a PR off with `/assign`, but `assign.yaml` only
runs on **issue** comments — it excludes PRs via
`!github.event.issue.pull_request`. The comment now says PR reassignment
is done from the GitHub UI.

No behavior change; comment-only.

## Background

This PR originally proposed sharing a concurrency group between
`assign.yaml` and `auto-assign-author.yaml`. That was based on a false
premise (that `/assign` runs on PRs): since `/assign` is issue-only and
auto-assign is PR-only, the two never operate on the same target and
can't race, so the coupling was dropped. The mirror change on the
operator repo (NVIDIA/nodewright#328) likewise reverted the coupling.

Signed-off-by: Brian Lockwood <lockwobr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/ci CI workflows, GitHub Actions, and repo tooling component/operator Skyhook operator (controller-manager)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants