Skip to content

fix(ci): don't let a transient GitHub API error fail the commitlint gate - #565

Merged
githubrobbi merged 1 commit into
mainfrom
fix/commitlint-transient-api-error
Jul 20, 2026
Merged

fix(ci): don't let a transient GitHub API error fail the commitlint gate#565
githubrobbi merged 1 commit into
mainfrom
fix/commitlint-transient-api-error

Conversation

@githubrobbi

Copy link
Copy Markdown
Collaborator

Summary

The commitlint gate's stale-advisory-comment cleanup looked up an
existing comment id via `gh api`. On a transient 5xx, `gh api` prints
its JSON error body to stdout while still exiting non-zero; the
existing `|| true` swallowed the exit code but not that body, so
`EXISTING_ID` could become garbage text instead of a real id. The
subsequent DELETE/PATCH then crashed on the malformed URL
(`net/url: invalid control character in URL`), failing this
required gate for a reason unrelated to title conformance.

Hit for real on release PR #564: the title conformed
(`"PR title matches Conventional Commits"` fired), but the lookup
503'd and the whole job died anyway.

Fix

Validate `EXISTING_ID` is purely numeric before trusting it; anything
else (including a JSON error blob) is treated as "no existing comment".

Test plan

  • `just workflow-drift` — structural validator still passes
  • `just gates-drift` — manifest/consumers still agree
  • `actionlint .github/workflows/commitlint.yml` — clean

gh api's stdout on a 5xx error is its JSON error body, but the command
still exits non-zero; the existing `|| true` swallowed the exit code
while EXISTING_ID still captured that JSON text as if it were a real
comment id. The subsequent DELETE/PATCH call then crashed on the
garbage URL, failing this *required* gate for a reason unrelated to
title conformance (release PR #564 hit this: title conformed, the
stale-comment-cleanup lookup 503'd, and the whole job died).

Validate EXISTING_ID is purely numeric before trusting it; anything
else (including a JSON error blob) is treated as "no existing comment"
so the conformance result stands on its own.
@githubrobbi
githubrobbi enabled auto-merge July 20, 2026 01:33
@githubrobbi
githubrobbi added this pull request to the merge queue Jul 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 20, 2026
@githubrobbi
githubrobbi added this pull request to the merge queue Jul 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 20, 2026
@githubrobbi
githubrobbi added this pull request to the merge queue Jul 20, 2026
Merged via the queue into main with commit 1735ff5 Jul 20, 2026
20 checks passed
@githubrobbi
githubrobbi deleted the fix/commitlint-transient-api-error branch July 20, 2026 02:45
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