Skip to content

ci(lint): allow long-running branches in promotion PRs#217

Merged
parth0025 merged 1 commit into
stagingfrom
ci/promotion-pr-validation
Jun 9, 2026
Merged

ci(lint): allow long-running branches in promotion PRs#217
parth0025 merged 1 commit into
stagingfrom
ci/promotion-pr-validation

Conversation

@parth0025

Copy link
Copy Markdown
Collaborator

Summary

Fix two CI workflow gaps that PR #216 (the first staging β†’ main promotion) surfaced:

  1. Branch-name validator rejected staging as a source branch
  2. Commitlint failed on hundreds of legacy commits that predate our Conventional Commits enforcement

Both fixes are scoped specifically to promotion PRs (source = staging or main). 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:

Check Root cause
❌ Branch name matches convention staging isn't in the allowlist β€” only <type>/<kebab>, release/v*, hotfix-backport/*, and bot branches were
❌ Commit messages (commitlint) The PR has 269 commits; many predate #209's commitlint setup and don't follow Conventional Commits
❌ PR title (Conventional Commits) Title was "Staging" instead of <type>: <desc> β€” fixable by edit, not a workflow gap
❌ Docker / Build & push image The pre-#213 broken Dockerfile is still on staging β€” resolves when #213 lands

This PR fixes the first two. Title is your responsibility; Docker resolves when #213 merges.

Files changed (2)

File Change
.github/workflows/branch-name.yml Add LONG_RUNNING='^(staging|main)$' pattern to the allow-set; surface it in the help-text
.github/workflows/commitlint.yml Add if: github.head_ref != 'staging' && github.head_ref != 'main' to the lint-commits job

Diff: +18 / -4 lines.

What changes β€” and what does NOT change

Promotion PRs (staging β†’ main, main β†’ hotfix)

Check Before After
Branch name ❌ Always failed βœ… staging and main accepted
lint-commits (per-commit validation) ❌ Always failed on legacy commits ⏭️ Skipped (job shows "Skipped" in CI)
lint-pr-title (PR title Conventional Commits) βœ… Ran βœ… Still runs β€” squash commit uses PR title
Docker / main.yml CI βœ… Ran as normal βœ… Still runs

Normal feature-branch PRs (feat/foo β†’ staging, fix/bar β†’ staging, etc.)

Check Before After
Branch name βœ… Validated βœ… Validated exactly the same β€” staging/main source is impossible for these
lint-commits βœ… Validated βœ… Validated exactly the same β€” head_ref is the topic branch
lint-pr-title βœ… Validated βœ… Validated

Zero 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 β†’ main promotion merges, the squash-merge button creates one new commit on main whose message is the PR title. That PR title is still validated by lint-pr-title (which we don't skip). So:

  • βœ… The commit that actually lands on main always follows Conventional Commits
  • βœ… The 269 legacy commits visible in the PR don't matter for main history once squashed
  • βœ… release-please reads commits on main, which all come from squash-validated PR titles

The 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_RUNNING pattern is safe

The pattern is anchored: ^(staging|main)$. It only matches the literal strings staging and main β€” nothing like staging-typo or main-fork would pass.

No one creates branches named staging or main other than the long-running ones (the repo would refuse anyway β€” those branches already exist).

Test plan

  • After this PR merges, re-trigger CI on PR chore(release): promote staging to main for v14.0.27Β #216 β€” the branch-name and lint-commits checks should pass (or skip, in the lint-commits case)
  • Open a test PR with branch name staging (or any name matching staging/main exactly) β†’ branch-name check passes
  • Open a test PR with a malformed branch name like not-following-convention β†’ branch-name check still fails (unchanged)
  • Open a test PR with a bad commit message on a normal feature branch β†’ lint-commits still fails (unchanged)
  • Verify lint-pr-title runs 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

  1. Click "Update branch" on PR chore(release): promote staging to main for v14.0.27Β #216 to pick up these workflow fixes
  2. Fix the PR title from "Staging" β†’ chore(release): promote staging to main for v14.0.27 (or similar)
  3. Wait for PR ci(docker): publish multi-arch images to GHCR + complete compose stackΒ #213 (Docker) to merge so the Docker check resolves
  4. Get 1 approving review
  5. Squash-merge

πŸ€– Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c4a6c3a-d734-4f19-a7a2-8d48a085be46

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • πŸ” Trigger review
✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/promotion-pr-validation

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

@parth0025 parth0025 self-assigned this Jun 9, 2026
@parth0025 parth0025 merged commit 5fb7852 into staging Jun 9, 2026
4 checks passed
@parth0025 parth0025 deleted the ci/promotion-pr-validation branch June 9, 2026 13:54
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