Skip to content

fix(ci): re-validate author association via REST in close-invalid-publish-prs#1440

Merged
rdimitrov merged 1 commit into
mainfrom
fix/close-invalid-prs-author-association
Jul 12, 2026
Merged

fix(ci): re-validate author association via REST in close-invalid-publish-prs#1440
rdimitrov merged 1 commit into
mainfrom
fix/close-invalid-prs-author-association

Conversation

@rdimitrov

Copy link
Copy Markdown
Member

What

Stage 2 of the auto-close automation (close-invalid-publish-prs.yml) re-derived the PR author association with:

gh pr view "$PR_NUMBER" --json authorAssociation --jq '.authorAssociation'

But gh pr view --json has no authorAssociation field. gh exits non-zero with Unknown JSON field: "authorAssociation", and because the step runs under set -euo pipefail, the whole job aborts before it comments, labels, or closes. Flagged PRs therefore stayed open.

Why it went unnoticed

  • Stage 1 (detect) was fine — it reads author_association from the event payload (github.event.pull_request.author_association), which is valid.
  • Only the stage-2 re-derivation was broken.
  • Every prior stage-2 run showed "success" because those PRs weren't flagged: with no artifact, stage 2 exits early at the artifact check and never reaches the broken line.
  • PR #1438 was the first genuine publish-attempt PR since the automation landed (ci: auto-close PRs that try to publish servers via the repo #1393), so it was the first to exercise the bug — run 29178568034 failed on exactly this line.

Fix

Fetch author_association from the REST pulls endpoint, which does expose it (verified: returns FIRST_TIME_CONTRIBUTOR for #1438):

gh api "repos/$GH_REPO/pulls/$PR_NUMBER" --jq '.author_association'

Both $GH_REPO and $PR_NUMBER are already-sanitized env vars, so no new injection surface.

Follow-up

Stage 2 is idempotent (guarded by the invalid label), so once merged a maintainer can re-run it — or simply re-open/re-close — to clean up #1438.

🤖 Generated with Claude Code

…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>
@rdimitrov rdimitrov merged commit 2d3262c into main Jul 12, 2026
7 checks passed
@rdimitrov rdimitrov deleted the fix/close-invalid-prs-author-association branch July 12, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant