Skip to content

Commit fb80e01

Browse files
authored
docs: bring guides, rules and examples in step with commit-check 2.19.2 (#57)
Before: the docs-sync test was red on main (`rev: v2.19.1` in five places, but 2.19.2 is on PyPI). Pasted outputs and examples had drifted from what the tool prints, and some guide pages described older Action and App behaviour. After: the pins read `v2.19.2`, the test passes, and every change below was checked against commit-check 2.19.2, Action v2.18.0 or the App's main branch. | Page | Before | After | |---|---|---| | configuration, example, guides/pre-commit | `rev: v2.19.1` | `rev: v2.19.2` | | rules, example | `[FAIL] CC003 subject_imperative: …` | `[FAIL] CC003 subject-imperative: …` (what `--compact` prints) | | rules CC003 sample | shortened error and suggestion | the full lines the tool prints | | rules CC012 | "Signed-off-by not found in latest commit" | catalog text "Signed-off-by trailer not found in the latest commit" | | rules CC016 sample | Suggest: Remove the AI sign-off … | Suggest: Use "Assisted-by: Claude" in place of the AI sign-off … | | rules CC101 | `ec2-user` as the failing example; "digits are rejected" | `12` (it fails; `ec2-user` passes); a correct description of the pattern | | rules CC005 | `fix: bug` as the failing example (it passes at 5) | `fix` | | getting-started step 3 | `git commit --amend -m …` (git refuses on the empty commit from step 2) | `git commit --amend --allow-empty -m …` | | getting-started CC201 | Suggest: … with allowed types | the real suggestion, mentioning `allow_branch_names` | | example | CC001 line cut short; `develop` missing from always-allowed names; bare `-m` called the commit-msg hook's form | full line; `develop` listed; the hook note moved to "From a file" | | index | "Real output of commit-check 2.18.0", shortened CC001 line | 2.19.2, full line | | troubleshoot | `12` called a "one-character name" and the recorded author; hook list without `check-tag`/`check-files`; `--tag` defaults missing | starts with a digit; the configured `user.name`; all seven hooks; SemVer default named | | configuration | "Inheritance fails quietly"; Python API "loads the file"; unquoted TOML regexes; `--tag` missing from the defaults table | fails open with a stderr notice, one level only; the API takes a dict; quoted values; `--tag` row added | | migration | "a trailing comma in an array" breaks TOML | removed (TOML allows it) | | guides/github-actions | `fetch-depth: 0` "or it only sees the most recent one"; forks "fail to post"; `GITHUB_TOKEN` passed by hand; no inputs list | shallow clones fall back to the API; fork comments are skipped with a warning; token not needed; inputs table, `pr-title` tip and `result` output | | guides/github-app | `2 of 4 checks failed` titles; "every commit"; "fetches nothing else" | `Commit message and branch failed (2 of 4 checks)`; newest 50 per push; the metadata it reads | | guides/organization | "silently falls back"; "last line" | stderr notice; "last lines" | | guides/policies | CC101/CC102 check the committer | the author | | compare/tools | PR title checking not credited | the Action's `pr-title` | `tests/docs_sync_test.py`: the `--compact` guard compared samples with the config key, which `--compact` stopped printing. It now compares them with the kebab-case name. How: `pytest tests` passes (10/10). The v2.19.2 items that another change covers are left out here: CC013 and the Copilot coding agent, the wrong-type config errors, the changelog, and the kernel cell in the AI-attribution article. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Clarified how commit checks handle pull request titles, squash messages, commit history, configuration inheritance, and fork workflows. * Updated examples and guidance for validation rules, branch names, author identity, tags, and pre-commit setup. * Added details about check results, permissions, and data accessed by the GitHub integrations. * **Tests** * Updated documentation checks to match kebab-case rule names in default and compact output. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com>
1 parent 39e60ab commit fb80e01

14 files changed

Lines changed: 101 additions & 70 deletions

‎docs/compare/tools.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ for the current state. GitHub's own rulesets are on
1616
| [commitcheck](https://github.com/marketplace/commitcheck) | A hosted App that applies one regular expression, set in its web admin | Commit message, pull request title or description, by regex | GitHub App | Free for public repositories; $25 a month for private ones |
1717
| [DCO app](https://github.com/apps/dco) and [DCO-2](https://github.com/cncf/dco2) | The sign-off check the Linux kernel and the CNCF use, with a remediation flow for missing sign-offs | `Signed-off-by` trailers | GitHub App | Free, open source |
1818
| [PRLint](https://github.com/ewolfe/prlint), [PR Title Checker](https://github.com/marketplace/actions/pr-title-checker) | Regular expressions over pull request fields | Title, body, labels, branch | App / Action | Free, open source |
19-
| **Commit Check** | One rule engine, [documented rule by rule](../rules.md), run as a hook, a CLI, an Action, a hosted App or an MCP tool | Commit message, branch name, author name and email, sign-off, AI attribution, force pushes, file size and paths, tag names; the squash message of a pull request | All of the above | Free, open source; the App's private organization repositories move to a paid plan later |
19+
| **Commit Check** | One rule engine, [documented rule by rule](../rules.md), run as a hook, a CLI, an Action, a hosted App or an MCP tool | Commit message, branch name, author name and email, sign-off, AI attribution, force pushes, file size and paths, tag names; the pull request title (Action) and the squash message of a pull request (App) | All of the above | Free, open source; the App's private organization repositories move to a paid plan later |
2020

2121
## What is different about Commit Check
2222

‎docs/configuration.md‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ flag overrides both for a single run.
2323
| `--message` | Conventional Commits ([CC001](rules.md#cc001)), subject lengths of 5–80 characters ([CC004](rules.md#cc004), [CC005](rules.md#cc005)), and an allow-list of ten commit types |
2424
| `--branch` | Conventional Branch ([CC201](rules.md#cc201)) and an allow-list of twenty-one branch types |
2525
| `--author-name` / `--author-email` | The built-in name and email patterns ([CC101](rules.md#cc101), [CC102](rules.md#cc102)) |
26+
| `--tag` | SemVer tag names, with an optional leading `v` ([CC401](rules.md#cc401)) |
2627

2728
Off until you turn them on: subject capitalization, imperative mood,
2829
required body and signoff, and rebase requirements.
@@ -89,8 +90,9 @@ It is a warning, not an error: the exit code and the JSON on stdout do not
8990
change. The top-level `warn` list and the GitHub App's
9091
[`[jira]`](guides/github-app.md#jira-ticket-references) and
9192
[`[pull_request]`](#pull-requests-every-commit-or-the-squash-message) sections
92-
are read elsewhere and are not reported. The Python API and the MCP server
93-
load the file themselves and do not report it either.
93+
are read elsewhere and are not reported. The Python API reads no file at all
94+
(it takes a `config` dict), and the MCP server loads the file itself without
95+
reporting unknown settings.
9496

9597
## Inheriting a shared config
9698

@@ -115,12 +117,15 @@ The value can be a GitHub shorthand, a local path or an HTTPS URL:
115117
| Local file | `../../shared/org-cchk.toml` |
116118
| HTTPS URL | `https://example.com/shared/cchk.toml` |
117119

118-
!!! note "Inheritance fails quietly"
120+
!!! note "Inheritance fails open"
119121

120122
If the target is unreachable or the format is not recognized, Commit Check
121-
ignores the inheritance and uses the local configuration alone. Plain HTTP
122-
URLs are rejected outright. A repository that silently stops inheriting
123-
still passes its own checks, so pin the branch when the policy matters.
123+
ignores the inheritance and uses the local configuration alone, printing a
124+
one-line `⊘ inherit_from ... could not be loaded` notice on stderr; the exit
125+
code does not change. Plain HTTP URLs are rejected the same way. Only one
126+
level is followed: an `inherit_from` inside the parent is ignored, with a
127+
notice. A repository that stops inheriting still passes its own checks, so
128+
pin the branch when the policy matters.
124129

125130
## Pull requests: every commit, or the squash message
126131

@@ -269,7 +274,7 @@ Used from a hook definition, with no config file anywhere in the repository:
269274
```yaml title=".pre-commit-config.yaml"
270275
repos:
271276
- repo: https://github.com/commit-check/commit-check
272-
rev: v2.19.1
277+
rev: v2.19.2
273278
hooks:
274279
- id: check-message
275280
args:
@@ -309,8 +314,8 @@ The full mapping between the three forms:
309314
| `require_body = false` | `CCHK_REQUIRE_BODY=false` | `--require-body=false` |
310315
| `require_signed_off_by = false` | `CCHK_REQUIRE_SIGNED_OFF_BY=false` | `--require-signed-off-by=false` |
311316
| `ignore_authors = ["bot"]` | `CCHK_IGNORE_AUTHORS=bot,user` | `--ignore-authors=bot,user` |
312-
| `author_email_pattern=^.+@example\.com$` | `CCHK_AUTHOR_EMAIL_PATTERN=^.+@example\.com$` | `--author-email-pattern=^.+@example\.com$` |
313-
| `author_name_pattern=^.+ .+$` | `CCHK_AUTHOR_NAME_PATTERN=^.+ .+$` | `--author-name-pattern=^.+ .+$` |
317+
| `author_email_pattern = '^.+@example\.com$'` | `CCHK_AUTHOR_EMAIL_PATTERN=^.+@example\.com$` | `--author-email-pattern=^.+@example\.com$` |
318+
| `author_name_pattern = '^.+ .+$'` | `CCHK_AUTHOR_NAME_PATTERN=^.+ .+$` | `--author-name-pattern=^.+ .+$` |
314319
| `conventional_branch = true` | `CCHK_CONVENTIONAL_BRANCH=true` | `--conventional-branch=true` |
315320
| `allow_branch_types = ["feature"]` | `CCHK_ALLOW_BRANCH_TYPES=feature,bugfix` | `--allow-branch-types=feature,bugfix` |
316321
| `allow_branch_names = ["staging", "production"]` | `CCHK_ALLOW_BRANCH_NAMES=staging,production` | `--allow-branch-names=staging,production` |

‎docs/example.md‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ revision.
1414

1515
=== "From the repository"
1616

17-
Validates `HEAD`'s message. This is what the `commit-msg` hook runs.
17+
Validates `HEAD`'s message.
1818

1919
```console
2020
$ commit-check -m
2121
```
2222

2323
=== "From a file"
2424

25+
This is what the `check-message` pre-commit hook runs, with the message
26+
file git hands it.
27+
2528
```console
2629
$ commit-check -m commit_message.txt
2730
```
@@ -54,7 +57,7 @@ revision.
5457
```console
5558
$ echo "updated the parser" | commit-check -m
5659
CC001 message check failed ==> updated the parser
57-
The commit message should follow Conventional Commits.
60+
The commit message should follow Conventional Commits. See https://www.conventionalcommits.org
5861
Suggest: Use <type>(<scope>): <description>, where <type> is one of: feat, fix, ...
5962
Docs: https://commit-check.com/rules/#cc001
6063
```
@@ -109,8 +112,8 @@ $ commit-check --branch
109112
```
110113

111114
Runs [CC201](rules.md#cc201), and [CC202](rules.md#cc202) if
112-
`require_rebase_target` is set. `master`, `main`, `HEAD` and `PR-*` are always
113-
accepted; everything else needs a `<type>/<description>` shape:
115+
`require_rebase_target` is set. `main`, `master`, `develop`, `HEAD` and `PR-*` are
116+
always accepted; everything else needs a `<type>/<description>` shape:
114117

115118
```text
116119
fix/empty-config-crash
@@ -159,7 +162,7 @@ pushed:
159162
```yaml title=".pre-commit-config.yaml"
160163
repos:
161164
- repo: https://github.com/commit-check/commit-check
162-
rev: v2.19.1
165+
rev: v2.19.2
163166
hooks:
164167
- id: check-no-force-push
165168
stages: [pre-push]
@@ -198,7 +201,7 @@ and how CLI, environment and file settings override each other.
198201

199202
```console
200203
$ commit-check -m --compact
201-
[FAIL] CC003 subject_imperative: docs: revamped the profile
204+
[FAIL] CC003 subject-imperative: docs: revamped the profile
202205
```
203206

204207
=== "No banner"

‎docs/getting-started.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Four things are happening in that output, and each is deliberate:
7777
## 3. Fix it
7878

7979
```console
80-
$ git commit --amend -m "fix(parser): handle empty input"
80+
$ git commit --amend --allow-empty -m "fix(parser): handle empty input"
8181
$ commit-check --message
8282
```
8383

@@ -93,7 +93,7 @@ $ commit-check --branch
9393
```text
9494
CC201 branch check failed ==> my-changes
9595
The branch should follow Conventional Branch. See https://conventionalbranch.org
96-
Suggest: Use <type>/<description> with allowed types
96+
Suggest: Use <type>/<description> with an allowed type, or add the branch to allow_branch_names in config
9797
Docs: https://commit-check.com/rules/#cc201
9898
```
9999

‎docs/guides/github-actions.md‎

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,36 @@ jobs:
3131
author-email: true
3232
```
3333
34-
1. Commit Check needs the full history to inspect every commit in the pull
35-
request. Without this it only sees the most recent one.
34+
1. Recommended, not required: the Action then reads the pull request's
35+
commits from the clone. With a shallow clone it lists them through the
36+
GitHub API instead (up to 250), and if it cannot, it warns and checks the
37+
head commit alone.
3638
3739
The Action reads the same `cchk.toml` as the CLI, so a repository that already
3840
has one needs no Action-specific configuration.
3941

42+
## Inputs
43+
44+
| Input | Default | What it does |
45+
|---|---|---|
46+
| `message` | `true` | Check every commit message of the pull request |
47+
| `branch` | `true` | Check the branch name |
48+
| `author-name` | `false` | Check each commit's author name |
49+
| `author-email` | `false` | Check each commit's author email |
50+
| `pr-title` | `false` | Check the pull request title against Conventional Commits, the one that matters for squash merges. Pull request events only |
51+
| `pr-comments` | `false` | Post the report as a pull request comment, edited in place on later runs |
52+
| `job-summary` | `true` | Write the report to the job summary |
53+
| `dry-run` | `false` | Report failures as warnings and always exit `0` |
54+
55+
`pull_request` does not fire when a title is edited. With `pr-title: true`,
56+
add `types: [opened, synchronize, reopened, edited]` to re-check a renamed pull
57+
request.
58+
59+
The Action also sets a `result` output: the check results as JSON, read with
60+
`fromJSON(steps.<id>.outputs.result)`. Its `status` is `pass`, `warn`, `skip`
61+
or `fail`, and each scope carries the same per-check fields as
62+
`commit-check --format json`.
63+
4064
## Making it a required check { #making-it-a-required-check }
4165

4266
Until it is required, a failing Commit Check does not stop anyone from
@@ -55,11 +79,10 @@ needs fixing directly on the PR:
5579
message: true
5680
branch: true
5781
pr-comments: ${{ github.event_name == 'pull_request' }}
58-
env:
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6082
```
6183

62-
This needs extra permissions on the job:
84+
The Action posts with the workflow's own token, so no `GITHUB_TOKEN` needs to
85+
be passed in. It does need extra permissions on the job:
6386

6487
```yaml
6588
permissions:
@@ -85,9 +108,10 @@ Turn it off once the history is clean.
85108

86109
A `pull_request` workflow triggered by a fork receives a **read-only**
87110
`GITHUB_TOKEN`, and `permissions: pull-requests: write` does not override that.
88-
`pr-comments` will therefore fail to post on fork pull requests unless the
89-
repository has *Send write tokens to workflows from pull requests* enabled under
90-
**Settings → Actions → General**.
111+
On such a run the Action skips the comment with a warning and says so in the
112+
job summary; the check, the annotations and the summary still work. For
113+
feedback on fork pull requests themselves, use the [GitHub App](github-app.md),
114+
which is not bound by the workflow's token.
91115

92116
!!! warning "Do not reach for `pull_request_target` casually"
93117

‎docs/guides/github-app.md‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ with the defaults, advisory only (see [Without a config file](#without-a-config-
3030
## What you get
3131

3232
On every push to a branch and on every pull request, each commit gets a check
33-
run named **Commit Check** on the Checks tab, in the commit's status and in the
33+
run named **Commit Check** (a push of more than 50 commits has its newest 50
34+
checked, and the older ones get one neutral "not checked" result) on the Checks tab, in the commit's status and in the
3435
merge box. (Tag pushes and branch deletions carry nothing to check; commits by
3536
bots are skipped, and squash mode checks a pull request as one message — both
3637
[below](#bots-re-runs-and-commits-checked-twice).) The result reads the same
3738
way everywhere:
3839

39-
- a one-line verdict — `All 4 checks passed`, or `2 of 4 checks failed`;
40+
- a one-line verdict — `All 4 checks passed`, or `Commit message and branch failed (2 of 4 checks)`;
4041
- for a failure, a table of what failed, the value that failed and the rule
4142
ID, linked to the [rule reference](../rules.md);
4243
- **How to fix**: the rule's own explanation and suggestion;
@@ -94,8 +95,9 @@ push or pull request, in the same four places: `cchk.toml`, `commit-check.toml`,
9495
`.github/commit-check.toml`. Every option on the
9596
[configuration page](../configuration.md) that belongs to a rule the App runs
9697
applies, precedence included; the `[push]`, `[files]` and `[tag]` sections are
97-
read but have nothing to act on here. Nothing is App-specific to set, apart
98-
from the two sections below.
98+
read but have nothing to act on here. Nothing is App-specific to set apart
99+
from `[pull_request]` (above) and `[jira]` (below); the CLI and the Action ignore
100+
them.
99101

100102
[`inherit_from`](organization.md) works, and a `github:` target is fetched with
101103
the App's own credentials, so a shared config in a private `.github` repository
@@ -113,7 +115,7 @@ rules.
113115

114116
A repository with no config file **and** no shared one has not chosen its
115117
rules, so its result is **advisory**: failures are reported in full, but the check is neutral — titled,
116-
say, `2 of 4 checks would fail (not enforced)` — and never blocks a merge. Below the
118+
say, `Commit message and branch would fail (2 of 4 checks, not enforced)` — and never blocks a merge. Below the
117119
fixes the report says why, and gives the smallest file that turns enforcement
118120
on:
119121

@@ -205,8 +207,10 @@ reports the same rule IDs — it just costs you CI minutes instead.
205207

206208
## Privacy
207209

208-
The App fetches the commits under test and the configuration file, nothing
209-
else, and stores nothing: no database, no copy of any message, author or
210+
The App fetches the commits under test, the configuration file (the
211+
repository's own or its account's shared one) and the repository metadata the
212+
checks need, such as the squash-merge settings and the comparison with a rebase
213+
target, and stores nothing: no database, no copy of any message, author or
210214
config. The [privacy page](../privacy.md) lists the permissions it asks for and
211215
what each one is used for.
212216

‎docs/guides/organization.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ allow_branch_types = ["feature", "bugfix", "hotfix", "release", "chore"]
2929
Where the [GitHub App](github-app.md) is installed on the organization, that
3030
file is already in force: a repository with no `cchk.toml` of its own is
3131
checked against the organization's, including repositories created tomorrow,
32-
and the check run's last line says so. The App reads the file with its own
32+
and the check run's report says so in its last lines. The App reads the file with its own
3333
credentials, so the `.github` repository can be private. A personal account's
3434
`.github` repository does the same for that account's repositories. A repository that
3535
commits its own config uses that instead — to build on the shared one rather
@@ -102,8 +102,8 @@ stderr and ignored.
102102
!!! warning "Inheritance fails open"
103103

104104
If the parent config is unreachable — a network blip, a renamed file, a
105-
private repository — Commit Check silently falls back to the local config
106-
rather than failing the build. This keeps CI green during an outage, but it
105+
private repository — Commit Check falls back to the local config, with a
106+
one-line notice on stderr, rather than failing the build. This keeps CI green during an outage, but it
107107
also means a typo in `inherit_from` is easy to miss. Verify the merged
108108
result when you first set it up:
109109

‎docs/guides/policies.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ $ git rebase --signoff main
6262

6363
The DCO is a statement about who wrote the code, so it only means something if
6464
the identity is real. [CC101](../rules.md#cc101) and
65-
[CC102](../rules.md#cc102) check the committer name and email, and are enabled
65+
[CC102](../rules.md#cc102) check the author name and email, and are enabled
6666
by default when their check runs:
6767

6868
```console

‎docs/guides/pre-commit.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Add Commit Check to `.pre-commit-config.yaml`:
88
```yaml title=".pre-commit-config.yaml"
99
repos:
1010
- repo: https://github.com/commit-check/commit-check
11-
rev: v2.19.1
11+
rev: v2.19.2
1212
hooks:
1313
- id: check-message
1414
- id: check-branch
@@ -68,7 +68,7 @@ Options can be passed as hook arguments, which keeps everything in one file:
6868
```yaml title=".pre-commit-config.yaml"
6969
repos:
7070
- repo: https://github.com/commit-check/commit-check
71-
rev: v2.19.1
71+
rev: v2.19.2
7272
hooks:
7373
- id: check-message
7474
args:
@@ -90,7 +90,7 @@ colon, and lets the commit through:
9090
```yaml title=".pre-commit-config.yaml"
9191
repos:
9292
- repo: https://github.com/commit-check/commit-check
93-
rev: v2.19.1
93+
rev: v2.19.2
9494
hooks:
9595
- id: check-message
9696
args: [--fix]

‎docs/index.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,12 @@ conventional_branch = <span class="cc-t-pass">true</span></div>
409409
<li><span><b>A fix you can paste</b>, whenever the correction is unambiguous.</span></li>
410410
</ol>
411411
</div>
412-
<!-- Real output of commit-check 2.18.0; the ASCII-art banner it prints first is left out. -->
412+
<!-- Real output of commit-check 2.19.2; the ASCII-art banner it prints first is left out. -->
413413
<div class="cc-diag">
414414
<p class="cc-t-dim">$ echo "Fix: add streaming support" | commit-check -m</p>
415415
<p><span class="cc-mark">1</span><span><span class="cc-t-fail cc-b">CC001</span> message check failed ==&gt;</span></p>
416416
<p><span class="cc-mark">2</span><span class="cc-t-white">Fix: add streaming support</span></p>
417-
<p><span class="cc-mark">3</span><span class="cc-t-dim">The commit message should follow Conventional Commits.</span></p>
417+
<p><span class="cc-mark">3</span><span class="cc-t-dim">The commit message should follow Conventional Commits. See https://www.conventionalcommits.org</span></p>
418418
<p><span class="cc-mark">4</span><span><span class="cc-t-blue">Suggest:</span> Use "<span class="cc-t-pass cc-b">fix: add streaming support</span>"</span></p>
419419
<p class="cc-diag__docs cc-t-dim">Docs: https://commit-check.com/rules/#cc001</p>
420420
</div>

0 commit comments

Comments
 (0)