Repository navigation
Replace the release commenter with a batched script & update node version - #1231
Conversation
…ate limit Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
busbyk
left a comment
There was a problem hiding this comment.
Couple issues found via Claude review
| prs=$(gh api "repos/$REPO/releases/generate-notes" -f tag_name="$TAG" --jq .body \ | ||
| | grep -oE '/pull/[0-9]+' | grep -oE '[0-9]+' | sort -un || true) |
There was a problem hiding this comment.
The || true swallows failures from gh itself, not just an empty result. I stubbed a 403 on generate-notes and the job prints "No pull requests found for v1.17.0." and exits 0 — green, no comments posted. That's the same symptom we're fixing here, so if the contents: read guess is wrong we won't find out from the run status.
Splitting the fetch from the parse keeps the loud failure and still handles a genuinely empty release:
notes=$(gh api "repos/$REPO/releases/generate-notes" -f tag_name="$TAG" --jq .body)
prs=$(printf '%s' "$notes" | grep -oE "$REPO/pull/[0-9]+" | grep -oE '[0-9]+$' | sort -un || true)Scoping the grep to $REPO also stops a PR title that links some other repo's /pull/123 from turning into a target here.
Generated by Claude Code
| if gh api "repos/$REPO/issues/$target/comments" --paginate --jq '.[].body' \ | ||
| | grep -qF "$release_url"; then |
There was a problem hiding this comment.
This can post duplicates. grep -q exits on first match, so if gh writes anything after that it dies on SIGPIPE, pipefail propagates 141, the if goes false and we comment on a target that already has the comment. Reproduced with a stub whose comment list already contained the release URL — it posted anyway.
It's a race, so it passes on small threads (which is why your v1.16.0 run showed "already mentions" every line) and breaks when gh --paginate fetches a second page, i.e. anything over 30 comments. Long-lived issues that collect a comment per release are exactly the ones that hit it.
existing=$(gh api "repos/$REPO/issues/$target/comments" --paginate --jq '.[].body')
if grep -qF "$release_url" <<<"$existing"; thenGenerated by Claude Code
…licate comments Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
#1231 bumped `actions/github-script` from v7 to v8 across the workflows, which touched `pr-visual-recap.yml` after `docs/agents/triage-labels.md` was last written. Drift flagged the doc as stale, and because CI checks the merge result rather than the branch tip, the failure surfaced here rather than on main. The doc quotes the gate's force-run thresholds and its sensitive-path list. Both are unchanged — `fileCount >= 25 || totalLines >= 1500` and the `src/(collections|migrations|access|globals|middleware.ts|payload.config.ts)` plus `src/app/api/` regex still read exactly as documented — so this is the false positive `--doc-is-still-accurate` exists for. Re-point the binding at the current file. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The drift gate has been red on main since #1231, which bumped actions/github-script from v7 to v8 in pr-visual-recap.yml without re-linking the doc bound to it. Reviewed docs/agents/triage-labels.md against the current workflow: the gate thresholds it documents (25+ files or 1500+ changed lines), the sensitive-path list, and the precedence of no-visual-recap over visual-recap all still match. Nothing in the doc needed changing, so this just refreshes the binding signature. Unrelated to the Payload patch on this branch; included because the gate blocks the PR. Co-Authored-By: Claude Opus 5 <[email protected]>
Description
The
🚀 This is included in version …comments didn't post for v1.16.0. Thepost-releasejob failed 5 seconds in with:apexskier/github-release-commenterwalks every commit in a release and fires a GraphQL query per commit to find its associated PRs. v1.16.0 had 197 commits since v1.15.1, so ~200 rapid-fire queries tripped GitHub's secondary rate limit during enumeration — before it posted a single comment.It tracks commit count, not PR count, and the only two failures in the workflow's history are our two biggest releases:
Clean break between 124 and 197, and our releases keep growing. A retry wouldn't help — the burst is the same size on every attempt. This replaces the action with a script that asks GitHub for the PR list once, so the request count scales with PRs (~48 calls for v1.16.0) instead of commits.
Related Issues
None.
Key Changes
POST /releases/generate-notesreturns every PR in the release in a single request (it picks the previous release as the base automatically).closingIssuesReferencesso we don't silently lose those.workflow_dispatchtrigger with ataginput, so a past release can be commented after the fact. Therelease: publishedevent only fires once and can't be replayed, which is why v1.13.0 stayed empty for four months.skip-label: dependenciesbehavior and the comment text verbatim.Dropping the action also drops an unmaintained dependency —
apexskier/github-release-commenteris at v1.4.1 (Jan 2026), has no throttle or retry input, and still targets Node 20 (already warning as deprecated in our logs).Following that Node 20 thread: a second commit bumps every action in
.github/workflows/to its lowest Node 24 major (two,peter-evans/find-comment@v2andcreate-or-update-comment@v3, were still on Node 16), verified against the live Blacksmith runner version 2.336.0.How to test
The logic was verified end-to-end against both failed releases by running the step body locally:
Both releases have already been backfilled — those comments are live now, posted from a local run, so they're authored by @rchlfryn rather than
github-actions[bot]. Every other release's comments stay bot-authored.To verify the guard rails on this branch:
Once merged,
gh workflow run post-release.yml -f tag=<tag>backfills any release (workflow_dispatchonly appears for workflows on the default branch).Screenshots / Demo video
N/A — CI-only change.
Migration Explanation
None needed — no schema changes.
Future enhancements / Questions
contents: readfor thegenerate-notescall, which the previouspermissions:block didn't grant. GitHub's REST docs don't state the fine-grained permission for that endpoint, so if the first real run 403s, bump it tocontents: write. Everything else in the script is proven against live data.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.