ci(lint): allow long-running branches in promotion PRs#217
Merged
Conversation
PR #216 (staging -> main, the first promotion) surfaced two gaps in our PR-validation workflows: 1. branch-name.yml validates the source branch against a fixed list of patterns. `staging` and `main` (used as source branches in promotion PRs and hotfix-merge-back flows) were not in the allowlist, so PR #216 failed the check. 2. commitlint.yml runs commitlint against every commit in the PR. For promotion PRs that aggregate hundreds of legacy commits (e.g. PR #216 brings 269 commits, many predating Conventional Commits enforcement), the check always fails. Both fixes are scoped to promotion-PR scenarios β they do NOT weaken validation for normal topic-branch PRs. branch-name.yml: - Add LONG_RUNNING='^(staging|main)$' to the allow-set, mirroring the documented promotion flow in BRANCHING.md - Update the help text to surface the staging|main option commitlint.yml: - Add `if: github.head_ref != 'staging' && github.head_ref != 'main'` to the lint-commits job, skipping per-commit validation when the source is a long-running branch - The PR title check (lint-pr-title) is unchanged β it still runs on every PR including promotion PRs, since the squash commit on merge uses the PR title Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the βοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix two CI workflow gaps that PR #216 (the first
staging β mainpromotion) surfaced:stagingas a source branchBoth fixes are scoped specifically to promotion PRs (source =
stagingormain). Normal feature-branch PRs continue to be validated exactly as before.Why this is needed
When you opened PR #216 (
staging β main), 4 checks failed:stagingisn't in the allowlist β only<type>/<kebab>,release/v*,hotfix-backport/*, and bot branches were<type>: <desc>β fixable by edit, not a workflow gapThis PR fixes the first two. Title is your responsibility; Docker resolves when #213 merges.
Files changed (2)
.github/workflows/branch-name.ymlLONG_RUNNING='^(staging|main)$'pattern to the allow-set; surface it in the help-text.github/workflows/commitlint.ymlif: github.head_ref != 'staging' && github.head_ref != 'main'to thelint-commitsjobDiff: +18 / -4 lines.
What changes β and what does NOT change
Promotion PRs (
staging β main,main β hotfix)stagingandmainacceptedlint-commits(per-commit validation)lint-pr-title(PR title Conventional Commits)Normal feature-branch PRs (
feat/foo β staging,fix/bar β staging, etc.)staging/mainsource is impossible for theselint-commitslint-pr-titleZero relaxation of normal-PR validation. The carve-out is bounded to promotion scenarios.
Why we don't lose validation by skipping lint-commits on promotion PRs
When a
staging β mainpromotion merges, the squash-merge button creates one new commit onmainwhose message is the PR title. That PR title is still validated bylint-pr-title(which we don't skip). So:mainalways follows Conventional Commitsmainhistory once squashedmain, which all come from squash-validated PR titlesThe trade-off is: we trust the squash commit on merge to be the source of truth. The legacy commits visible in the staging history are not (and cannot be) retroactively rewritten.
Why the
LONG_RUNNINGpattern is safeThe pattern is anchored:
^(staging|main)$. It only matches the literal stringsstagingandmainβ nothing likestaging-typoormain-forkwould pass.No one creates branches named
stagingormainother than the long-running ones (the repo would refuse anyway β those branches already exist).Test plan
staging(or any name matchingstaging/mainexactly) β branch-name check passesnot-following-conventionβ branch-name check still fails (unchanged)lint-pr-titleruns on promotion PRs (it must β that's how the squash commit's message gets validated)After this PR merges β what to do with PR #216
chore(release): promote staging to main for v14.0.27(or similar)π€ Generated with Claude Code