ci: stop auto-assign failing on bot and fork pull requests - #140
Open
rashmiadvani wants to merge 1 commit into
Open
ci: stop auto-assign failing on bot and fork pull requests#140rashmiadvani wants to merge 1 commit into
rashmiadvani wants to merge 1 commit into
Conversation
rashmiadvani
requested review from
hshanmug12,
maheshmunnangi and
srpatcha
as code owners
August 17, 2026 07:44
The Auto Assign PR workflow failed on two entire classes of PR, leaving a
red check unrelated to the change under review:
* Dependabot PRs -- bot accounts are not assignable, so the API returned
403 Forbidden for {"assignees":["dependabot[bot]"]}.
* Fork PRs -- fork-originated pull_request runs get a read-only
GITHUB_TOKEN, so addAssignees returned 403 "Resource not accessible by
integration" regardless of the permissions block.
Guard the job so it runs only when assignment can succeed: the PR must
originate in this repository and the author must not be a bot. Also grant
`issues: write`, since addAssignees belongs to the issues API and was not
covered by the existing `pull-requests: write` grant.
Not switched to pull_request_target: that grants a writable token, but
GitHub silently ignores assignees without push access, so fork authors
still would not be assigned -- a security-sensitive trigger for a green
check that does nothing.
rashmiadvani
force-pushed
the
fix/auto-assign-skip-bot-authors
branch
from
August 17, 2026 17:03
74c9177 to
fd79749
Compare
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.
Problem
The
Auto Assign PRworkflow fails on two whole classes of pull request. Becauseit fires on every
pull_request: [opened], the failure is not occasional — it isguaranteed for any Dependabot PR and any fork-authored PR, so those PRs carry a
red ❌ that has nothing to do with the change under review.
This is the failure mode that trains reviewers to ignore red checks, which is
what makes it worth fixing rather than muting.
Failure 1 — bot authors cannot be assigned
Every Dependabot PR. Captured from an
Auto Assign PRrun log:Failure 2 — fork PRs get a read-only token
Every PR opened from a fork. Distinct error, distinct cause:
Per the GitHub Actions documentation: "The GITHUB_TOKEN has read-only permissions
in pull requests from forked repositories." The
permissions:block cannot liftthat cap — it can only narrow what the token already has.
Root cause
403 Forbidden403 Resource not accessible by integrationpull_requestruns get a read-only tokenaddAssigneesis the issues API; the workflow only grantedpull-requests: writeCause 3 never surfaced because 1 and 2 fail first, but it would break same-repo
PRs the moment they are the only case left.
The fix
originates in this repository and the author is not a bot.
issues: write.addAssigneesis part of the issues API and is notcovered by
pull-requests: write.The assignment step itself is untouched.
Behaviour
403 Forbidden403 not accessibleAlternative considered and rejected:
pull_request_targetThe usual advice for cause 2 is to switch the trigger to
pull_request_target,which runs in the base-repo context with a writable token. I deliberately did
not do this, for two reasons:
can add assignees to an issue. Assignees are silently ignored otherwise."
Outside fork contributors do not have push access, so the assignment would be
silently dropped. The check would turn green while doing nothing — strictly
worse than skipping, because it hides the fact that nothing happened.
code on the pull_request_target trigger may lead to security vulnerabilities …
including cache poisoning and granting unintended access to write privileges
or secrets." Adding that trigger to buy a misleading green check is a bad
trade.
Skipping the unsatisfiable cases is honest about what the workflow can do.
Verification
actionlintclean on the modified workflow..github/workflows/auto-assign.yml; 1 file,additions only.
observed rather than theorised.
on
types: [opened]only, so updating this branch does not re-run it; there isno
Auto Assign PRrun against the fixed commit to point at. Its effect isobservable on the first PR opened after merge.
not have push access here, so I cannot open a same-repo PR to test it. The
assignment step is unchanged and
issues: writeonly widens the existing grant.I cannot claim this is verified end-to-end. What is established: both failure
modes are reproduced from logs, and the guard expression excludes exactly those two
cases. What is not: that the success path still assigns, and that the skip happens
in a live run. Reviewers with push access can confirm both quickly after merge.
Scope
The same defect is present in 13 org repositories; a matching PR is open for
each.
eDBis excluded — it usestoshimaru/auto-author-assign, which alreadyhandles this, and its CI is green.