Skip to content

Replace the release commenter with a batched script & update node version - #1231

Merged
rchlfryn merged 3 commits into
mainfrom
fix/post-release-rate-limit
Sep 1, 2026
Merged

rchlfryn merged 3 commits into
mainfrom
fix/post-release-rate-limit

Conversation

@rchlfryn

@rchlfryn rchlfryn commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The 🚀 This is included in version … comments didn't post for v1.16.0. The post-release job failed 5 seconds in with:

##[error]HttpError: You have exceeded a secondary rate limit.

apexskier/github-release-commenter walks 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:

Release Commits PRs Result
v1.13.0 242 20 ❌
v1.16.0 197 23 ❌
v1.12.0 124 11 ✅
v1.15.0 81 8 ✅
v1.14.0 60 11 ✅
v1.15.1 24 5 ✅

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

  • Ask once instead of per-commit. POST /releases/generate-notes returns every PR in the release in a single request (it picks the previous release as the base automatically).
  • Still comments on linked issues. The old action followed each PR to the issues it closes — for v1.16.0 that's 19 PRs + 9 linked issues = 28 targets. The script follows closingIssuesReferences so we don't silently lose those.
  • Idempotent. Each target is checked for an existing mention of the release URL before commenting, so re-runs and backfills can't double-post. The old action had no such guard.
  • Backfillable. Added a workflow_dispatch trigger with a tag input, so a past release can be commented after the fact. The release: published event only fires once and can't be replayed, which is why v1.13.0 stayed empty for four months.
  • Preserves the existing skip-label: dependencies behavior and the comment text verbatim.

Dropping the action also drops an unmaintained dependency — apexskier/github-release-commenter is 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@v2 and create-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:

  • v1.16.0 → 19 PRs → 28 comment targets
  • v1.13.0 → 20 PRs → 26 comment targets

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:

# extract the step body, then:
REPO=NWACus/web TAG=v1.16.0 GH_TOKEN=$(gh auth token) bash step.sh
# every line should read "#N already mentions v1.16.0." — no new comments

Once merged, gh workflow run post-release.yml -f tag=<tag> backfills any release ( workflow_dispatch only 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

  • One unverified detail: the job now needs contents: read for the generate-notes call, which the previous permissions: 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 to contents: write. Everything else in the script is proven against live data.
  • The next release is the real test. If it posts clean, this is settled; if not, the failure will be loud and specific rather than a silent secondary-limit abort.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@github-actions

Copy link
Copy Markdown
Contributor

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@busbyk busbyk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple issues found via Claude review

Comment thread .github/workflows/post-release.yml Outdated
Comment on lines +39 to +40
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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e619501

Comment thread .github/workflows/post-release.yml Outdated
Comment on lines +73 to +74
if gh api "repos/$REPO/issues/$target/comments" --paginate --jq '.[].body' \
| grep -qF "$release_url"; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"; then

Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e619501

@rchlfryn rchlfryn changed the title Replace the release commenter with a batched script Replace the release commenter with a batched script & update node version Aug 27, 2026
…licate comments

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@rchlfryn
rchlfryn added this pull request to the merge queue Sep 1, 2026
Merged via the queue into main with commit 67ebceb Sep 1, 2026
15 checks passed
@rchlfryn
rchlfryn deleted the fix/post-release-rate-limit branch September 1, 2026 20:24
busbyk added a commit that referenced this pull request Sep 1, 2026
#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]>
busbyk added a commit that referenced this pull request Sep 3, 2026
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]>

This branch was previously deployed

1 inactive deployment
Preview — e6195014 Deployed Aug 27, 2026 by rchlfryn via deploy #2141
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.

2 participants