fix(ci): re-validate author association via REST in close-invalid-publish-prs#1440
Merged
Merged
Conversation
…lish-prs
Stage 2 of the auto-close automation re-derived the PR author association
with `gh pr view --json authorAssociation`, but `gh pr view` has no such
field. `gh` exits non-zero ("Unknown JSON field") and, under
`set -euo pipefail`, the whole step aborts before commenting/labeling/
closing — so flagged PRs stayed open.
Detect (stage 1) reads author_association from the event payload, which is
valid; only the stage-2 re-derivation was broken. This was latent until the
first genuine publish-attempt PR (#1438) exercised it.
Fix: fetch author_association from the REST pulls endpoint, which does
expose it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Stage 2 of the auto-close automation (
close-invalid-publish-prs.yml) re-derived the PR author association with:But
gh pr view --jsonhas noauthorAssociationfield.ghexits non-zero withUnknown JSON field: "authorAssociation", and because the step runs underset -euo pipefail, the whole job aborts before it comments, labels, or closes. Flagged PRs therefore stayed open.Why it went unnoticed
author_associationfrom the event payload (github.event.pull_request.author_association), which is valid.29178568034failed on exactly this line.Fix
Fetch
author_associationfrom the REST pulls endpoint, which does expose it (verified: returnsFIRST_TIME_CONTRIBUTORfor #1438):Both
$GH_REPOand$PR_NUMBERare already-sanitized env vars, so no new injection surface.Follow-up
Stage 2 is idempotent (guarded by the
invalidlabel), so once merged a maintainer can re-run it — or simply re-open/re-close — to clean up #1438.🤖 Generated with Claude Code