Skip to content

ci(repo): guard release workflow against stale-SHA runs#8591

Open
jacekradko wants to merge 4 commits into
mainfrom
jacek/guard-release-stale-sha
Open

ci(repo): guard release workflow against stale-SHA runs#8591
jacekradko wants to merge 4 commits into
mainfrom
jacek/guard-release-stale-sha

Conversation

@jacekradko
Copy link
Copy Markdown
Member

@jacekradko jacekradko commented May 18, 2026

On 2026-05-18 the production release workflow failed because it ran on an older Version-packages commit after a newer one had already shipped: changeset publish was a no-op, git push failed non-fast-forward, the inline recovery step fired, and Slack got an alert for a no-op release.

This adds a guard step that fetches origin/main and cancels the run if HEAD has been superseded, so the older run is stopped before build instead of grinding through to a confusing push error. Cancelling (rather than failing) matches what concurrency: cancel-in-progress would produce, so the Actions UI reads accurately.

The downstream-dispatch recovery logic also moves into a reusable workflow at .github/workflows/release-recovery.yml (triggers: workflow_call + workflow_dispatch). The release job exposes the changesets step's conclusion as a job output, and a dependent recover job invokes the reusable workflow with the same gating condition as the old inline step. That also gives us a manual entry point (gh workflow run release-recovery.yml) so re-firing downstream dispatches no longer requires re-running a stale release.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment May 18, 2026 8:34pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

🦋 Changeset detected

Latest commit: c9ccf72

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 0859dd27-8020-4e70-9aa8-6ee7dd3ca1e8

📥 Commits

Reviewing files that changed from the base of the PR and between bb8ad8d and c9ccf72.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yml

📝 Walkthrough

Walkthrough

This PR exposes the Changesets step result as a release job output, adds a guard step that fetches origin/main and exits when the run's HEAD is superseded, removes the inline downstream-recovery step from the release job, and adds a conditional recover job that calls a new reusable Release Recovery workflow (.github/workflows/release-recovery.yml). The new workflow checks local package versions, skips pre-releases or pre-mode, verifies npm publication for clerk-js/ui, and dispatches downstream workflows (sdk-infra-workers, dashboard, clerk-docs). The changeset file was updated.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding a guard step to prevent the release workflow from running on stale SHAs.
Description check ✅ Passed The description thoroughly explains the problem, solution, and implementation details, directly relating to all changes in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release-recovery.yml:
- Around line 30-34: The checkout step ("name: Checkout repo" using
actions/checkout@v4) must be pinned to the main branch so the workflow always
reads package versions from main; update the checkout step to include ref: main
under its with block (i.e., add a "ref: main" setting for the
actions/checkout@v4 invocation) so workflow_dispatch runs don't use arbitrary
refs.

In @.github/workflows/release.yml:
- Around line 60-68: The step "Ensure HEAD is origin/main" currently uses exit 1
to skip stale runs which fails the job; change this to emit a step output (e.g.,
set a "stale" output via the GITHUB_OUTPUT file) and exit successfully instead
of exiting 1. Concretely, in the same step (id it e.g., ensure_head), when
local_sha != remote_sha echo the notice, write "stale=true" to $GITHUB_OUTPUT
and exit 0; otherwise write "stale=false". Then gate downstream steps with an if
condition that checks steps.ensure_head.outputs.stale == 'false' so stale runs
complete successfully without failing the job.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 544ead69-3773-4288-ac35-026396ce30aa

📥 Commits

Reviewing files that changed from the base of the PR and between 6eaf4d6 and f6bfe2b.

📒 Files selected for processing (3)
  • .changeset/clean-deer-march.md
  • .github/workflows/release-recovery.yml
  • .github/workflows/release.yml

Comment thread .github/workflows/release-recovery.yml
Comment thread .github/workflows/release.yml
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 18, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8591

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8591

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8591

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8591

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8591

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8591

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8591

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8591

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8591

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8591

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8591

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8591

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8591

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8591

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8591

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8591

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8591

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8591

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8591

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8591

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8591

commit: c9ccf72

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

120-120: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Sync comment references removed step.

The inline "Recover downstream notifications" step was removed and replaced by release-recovery.yml. Update the comment to reference the correct location.

📝 Suggested fix
-            // NOTE: Keep in sync with the `targets` array in the "Recover downstream notifications" step below.
+            // NOTE: Keep in sync with the `targets` array in release-recovery.yml
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml at line 120, Update the inline comment that
currently references the removed "Recover downstream notifications" step so it
points to the new workflow file `release-recovery.yml`; locate the comment
string "// NOTE: Keep in sync with the `targets` array in the \"Recover
downstream notifications\" step below." and change the text to reference
`release-recovery.yml` (and its `targets` array) instead of the removed step so
the note stays accurate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/release.yml:
- Line 120: Update the inline comment that currently references the removed
"Recover downstream notifications" step so it points to the new workflow file
`release-recovery.yml`; locate the comment string "// NOTE: Keep in sync with
the `targets` array in the \"Recover downstream notifications\" step below." and
change the text to reference `release-recovery.yml` (and its `targets` array)
instead of the removed step so the note stays accurate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 9e845213-106d-43ff-8904-e0f010ee642d

📥 Commits

Reviewing files that changed from the base of the PR and between f6bfe2b and 60c6a23.

📒 Files selected for processing (2)
  • .github/workflows/release-recovery.yml
  • .github/workflows/release.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant