ci(repo): post Major Version Check as a commit status on the PR head#8761
Conversation
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 detectedLatest commit: 0b9cb26 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe PR updates the major version check workflow to post commit statuses on the PR head SHA, paginate PR files and comments, inspect ChangesMajor Version Check Workflow Refactor
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
.changeset/major-version-check-pr-head-status.md.github/workflows/major-version-check.yml
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.
Approving an
!allow-majorbump never cleared this check, because theissue_commentre-run's implicit check-run lands onmain, not the PR head, which is why it couldn't be required. It now writes an explicitMajor Version Checkcommit 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-majorfrom a private member is silently ignored (approvers need publicclerkmembership); 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
deletedand paginates the file/comment lists. Follow-up after merge: addMajor Version Checkto the required checks onmain, merge-first or it blocks every open PR waiting on a context that doesn't exist yet.Summary by CodeRabbit