Skip to content

fix(ci): grade every non-merge commit a PR proposes - #45

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/commit-gate-grades-pr-range
Sep 22, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/commit-gate-grades-pr-range

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Fixes #37.

What changed

.github/workflows/ci.yml, Repo hygiene job:

  • The Commit convention check now grades every commit the PR proposes — git log --no-merges <base>..<head> — instead of only the tip. On push it grades <before>..<head> (tip alone when the ref has no recorded before-sha).
  • Merge commits are excluded (--no-merges): a PR whose head is a merge commit created by GitHub's own Update branch button but whose own commits all conform now passes.
  • Every offender is named by sha in the ::error annotation, not just the subject.
  • The fetch depth the range depends on is pinned explicitly (fetch-depth: 0), and an unresolvable range fails loudly (cannot resolve <sha> ... refusing to grade zero commits).
  • Zero graded commits fails (no non-merge commits ... refusing a vacuous pass) — a gate that examines nothing must not report success.

Acceptance criteria check

  1. ✅ grades the whole --no-merges base..head range
  2. ✅ merge commits excluded; merge-tipped conforming PR passes
  3. ✅ non-conforming non-merge commit fails, error names the sha
  4. ✅ depth explicit (fetch-depth: 0); unresolvable range fails loudly
  5. ✅ empty range fails — verified in harness

Local verification

Extracted the exact step script and ran it against a synthetic repo:

scenario expected observed
PR tip is an Update-branch merge commit, own commits conform pass pass (2 commits graded)
PR adds one non-conforming non-merge commit fail naming it ::error::commit ea57869... fails the conventional pattern: broken subject here
range contains only merge commits fail loudly refusing a vacuous pass
unresolvable base sha fail loudly cannot resolve deadbeef...; refusing to grade zero commits
push before..head conforming / non-conforming pass / fail pass / fail naming the sha

Repo hygiene gates (check-format.sh, check-lint.sh, check-spdx.sh, config/ci/lintSource.jl equivalent) pass on this branch. YAML validated.

The commit convention gate judged exactly one commit, the PR tip. When
GitHub's own Update-branch button makes the tip a merge commit, a
conforming PR goes red; and a branch where only the tip conforms passes
regardless of its other commits (#37).

Grade the base..head range instead (before..head on push), exclude
merge commits, name every offender by sha, and fail loudly when the
range is unresolvable or contains no non-merge commits rather than
reporting a vacuous pass. Fetch depth is pinned to 0 so the range
always resolves.

Closes #37
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c07c44f8-4d19-4fae-a27c-780e564e1d14

📥 Commits

Reviewing files that changed from the base of the PR and between 4df7881 and 78eb82d.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 27915f3 into main Sep 22, 2026
4 checks passed
@hyperpolymath
hyperpolymath deleted the fix/commit-gate-grades-pr-range branch September 22, 2026 08:05
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.

Commit convention check fails on merge commits, so GitHub's own "Update branch" button reds a conforming PR

1 participant