Skip to content

ci(repo): post Major Version Check as a commit status on the PR head#8761

Merged
jacekradko merged 5 commits into
mainfrom
jacek/major-version-check-pr-head-status
Jun 29, 2026
Merged

ci(repo): post Major Version Check as a commit status on the PR head#8761
jacekradko merged 5 commits into
mainfrom
jacek/major-version-check-pr-head-status

Conversation

@jacekradko

@jacekradko jacekradko commented Jun 5, 2026

Copy link
Copy Markdown
Member

Approving an !allow-major bump never cleared this check, because the issue_comment re-run's implicit check-run lands on main, not the PR head, which is why it couldn't be required. It now writes an explicit Major Version Check commit status to the PR head on every run, and keeps the job green even when posting a red status so the approval re-run's green isn't shadowed by a stale red check-run.

Two things to scrutinize: approver detection uses the default GITHUB_TOKEN, which only sees public org members, so !allow-major from a private member is silently ignored (approvers need public clerk membership); and fork PRs get a read-only token, so the workflow swallows that one 403 to stay green while rethrowing everything else, including a transient 403/5xx during the membership check that would otherwise drop a valid approval.

Also recomputes on comment deleted and paginates the file/comment lists. Follow-up after merge: add Major Version Check to the required checks on main, merge-first or it blocks every open PR waiting on a context that doesn't exist yet.

Summary by CodeRabbit

  • Chores
    • Enhanced the major version check workflow to post an explicit commit status directly on the pull request head for clearer visibility.
    • Added support for reacting to relevant issue comments in addition to existing pull request events.
    • Updated major-change detection to review changeset metadata and require an explicit approval comment before allowing major changes, otherwise the check reports failure.

The major-version guard reported pass/fail only via the implicit github-script
job check-run. On issue_comment runs (the !allow-major re-run) that check-run is
tied to the default branch, not the PR head, so approving a major bump never
updated the PR head's status. That made the check unsafe to require: a major PR
would stay blocked even after approval.

Post an explicit "Major Version Check" commit status to the PR head SHA on every
run, so the required context flips red->green correctly regardless of trigger
event. Also paginate listFiles/listComments so a changeset or approval comment
past the first page isn't missed now that this gates merges.
@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0b9cb26

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

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jun 29, 2026 4:13pm
swingset Ready Ready Preview, Comment Jun 29, 2026 4:13pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates the major version check workflow to post commit statuses on the PR head SHA, paginate PR files and comments, inspect .changeset/ frontmatter for major, and validate !allow-major approvals from organization members.

Changes

Major Version Check Workflow Refactor

Layer / File(s) Summary
Permissions, infrastructure, and changeset metadata
.changeset/major-version-check-pr-head-status.md, .github/workflows/major-version-check.yml
Workflow permissions add statuses: write, the script resolves PR and head SHA for both trigger payload shapes, and a new changeset markdown file is added.
Commit status posting
.github/workflows/major-version-check.yml
A shared helper posts commit statuses to the PR head SHA with repos.createCommitStatus, and HTTP 403 responses are warned on without failing the job.
Major changeset detection
.github/workflows/major-version-check.yml
PR files are paginated, non-removed .changeset/ files are fetched at the head ref, and only YAML frontmatter is checked for a major field; missing majors post success and exit.
Approval verification and final status
.github/workflows/major-version-check.yml
PR comments are paginated to find trimmed, case-insensitive !allow-major comments, commenters are verified with orgs.checkMembershipForUser, and the result posts success or failure statuses while leaving the job non-failing.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested Reviewers

  • wobsoriano

Poem

🐇 I hop through checks with status bright,
A PR head shines in GitHub light,
Major blooms in YAML's nest,
!allow-major seals the rest,
With rabbit paws, the workflow's set 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main workflow change: posting Major Version Check as a commit status on the PR head.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@8761

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@8761

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@8761

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 0b9cb26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/major-version-check.yml:
- Around line 101-112: The catch block around
github.rest.orgs.checkMembershipForUser currently swallows all errors; change it
to only ignore a 404 by checking error?.status === 404 and continuing in that
case, but rethrow any other errors so transient 403/5xx fail fast; update the
catch that wraps the call to github.rest.orgs.checkMembershipForUser (the block
referencing comment.user.login and approvalFound) to implement this conditional
rethrow.
🪄 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), Repository UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: ebe6bfe6-06fb-45cb-85b5-de8a05713ccb

📥 Commits

Reviewing files that changed from the base of the PR and between 83f50f6 and 84d3685.

📒 Files selected for processing (2)
  • .changeset/major-version-check-pr-head-status.md
  • .github/workflows/major-version-check.yml

Comment thread .github/workflows/major-version-check.yml Outdated
Add `deleted` to the issue_comment triggers so removing the !allow-major
comment recomputes the status; a stale approval no longer leaves a required
major bump mergeable. Tolerate the read-only token that fork pull_request runs
get by swallowing the createCommitStatus 403 (keeps the job green and re-throws
any other error). Guard a null comment body and note that checkMembershipForUser
only detects public org members.
A transient 403/5xx during checkMembershipForUser previously fell through to a
failure status, which could flip an already-approved major PR back to red. Only
treat 404 as "not a member" and rethrow other errors so a hiccup fails the run
loudly instead of silently dropping a valid approval. Matches the pattern in
e2e-staging.yml.
@jacekradko jacekradko merged commit b9edd48 into main Jun 29, 2026
51 checks passed
@jacekradko jacekradko deleted the jacek/major-version-check-pr-head-status branch June 29, 2026 20:39
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.

3 participants