Repository navigation
ci(merge): gate the test checkbox on write access, not author_association - #130
Merged
smith-xyz merged 1 commit intoOct 23, 2026
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smith-xyz The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
What changed
The first cut of this workflow gated the test checkbox on
author_associationinOWNER / MEMBER / COLLABORATOR. In production that gate rejects the very person it was written for:author_associationis computed from the base repo, so a PR opened from a fork isCONTRIBUTOReven when its author is an org owner with admin on the repo. Since the fork workflow (origin=smith-xyz, PR headsmith-xyz:branch) is how PRs actually arrive here, the checkbox could never arm anything.The fix
Ask the API for the author's real permission instead of trusting the association:
The checkbox counts for
admin,maintain, orwrite. Anything else falls back to theautomergelabel, which needs triage or better to apply.Verified against the API rather than assumed: a probe workflow run with a plain workflow token (
permissions: contents: write, pull-requests: write) returns200 {"permission": "admin"}for asmith-xyzfork PR whoseauthor_associationisCONTRIBUTOR.GET /orgs/{org}/members/{login}is not usable there (302, needsread:org), and the org membership is not public, so the collaborators endpoint is the one anchor a token can read.Behaviour, all 15 cases
automergelabelMerge commit only, and arming still needs the PR to be open, non-draft, and based on
development.Also in here
The file has to sit on the default branch for
pull_request_targetto fire at all (this repo defaults tomain, code lives ondevelopment), which is why the companion PR targetsmain. Identical file, one commit each.