| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A GitHub Action for checking commit message formatting, branch naming, committer name, email, commit signoff, and more.
Important
This v2 release introduces several 🚨breaking changes. Please review the Breaking Changes section carefully before upgrading.
Create a new GitHub Actions workflow in your project, e.g. at .github/workflows/commit-check.yml
name: Commit Check
on:
pull_request:
branches: 'main'
jobs:
commit-check:
runs-on: ubuntu-latest
permissions: # use permissions because use of pr-comments
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # Required for merge-base checks
- uses: commit-check/commit-check-action@v2
with:
message: true
branch: true
author-name: false
author-email: false
job-summary: true
pr-comments: trueNote
This action supports running on Linux, macOS, and Windows (ubuntu-latest, macos-latest, windows-latest).
Apache
discovery-unicamp
Texas Instruments
OpenCADC
Extrawest
Chainlift
Mila
RLinf
Collective
cpp-linter
and many more.
Note
pr-comments is disabled by default.
PR comments are skipped for pull requests from forked repositories. See docs/fork-pr-comments.md for details on how to enable this feature for fork contributions.
Note: write-access to pull-requests requires the pull-requests: write permission. See usage example.
Tip
This is especially useful for teams using Squash & Merge, where the PR title becomes the final commit message in the main branch. When enabled, the action validates the PR title against your Conventional Commits configuration, giving early feedback at PR time rather than after merge.
pr-title works alongside message — you can enable both to validate the PR title and individual commits, or just one depending on your workflow.
This setting only applies to pull_request and pull_request_target events; it is silently ignored on push events.
Important
By default, pull_request does not trigger on title changes. To validate the PR title immediately when updated, add edited to your workflow's event types:
on:
pull_request:
types: [opened, synchronize, reopened, edited]Without edited, only the initial title (at PR creation) is validated.
The Optional Inputs above cover the most common settings. For everything else (e.g., subject-capitalized, require-signed-off-by, ai-attribution, custom allow-commit-types, etc.), you have two approaches:
Set any CCHK_* environment variable in your workflow step — no config file required:
- uses: commit-check/commit-check-action@v2
env:
CCHK_SUBJECT_CAPITALIZED: "true"
CCHK_REQUIRE_SIGNED_OFF_BY: "true"
CCHK_AI_ATTRIBUTION: "forbid"
CCHK_ALLOW_COMMIT_TYPES: "feat,fix,docs,chore"All available environment variables follow the naming convention: CCHK_ + uppercase option name with underscores instead of hyphens. See the full mapping in the commit-check documentation.
Add a commit-check.toml or cchk.toml to the root of your repository. Refer to the configuration guide for all available options.
Note
Configuration priority: CLI args > environment variables > config file > defaults. The action itself doesn't set any CLI flags beyond those in Optional Inputs, so env vars and config files are the recommended way to customize.
Structured check results as JSON, available to downstream steps via fromJSON:
- uses: commit-check/commit-check-action@v2
id: commit-check
with:
dry-run: true # (1)
- name: Inspect results
run: |
echo "Status: ${{ fromJSON(steps.commit-check.outputs.result).status }}"
echo "Scopes: ${{ toJSON(fromJSON(steps.commit-check.outputs.result).scopes) }}"Each scope carries the check outcomes (rule_id, check, status, value, error, suggest, docs_url) exactly as produced by commit-check --format json, so downstream jobs can build their own reports or gate on individual rules.
By default, commit-check-action results are shown on the job summary page of the workflow. The report below is reproduced as the action renders it, except that its title is a heading in the real thing — it is bold here so it stays out of this page's table of contents — and the footer names the version that actually ran.
Passing runs stay to one line, with the detail folded away:
Commit Check
✅ All 3 checks passed
Show all 3 checksCommit message ✔ PR title (feat: add login page) ✔ Commit 1/2 (feat: add login page) Branch ✔ Branch (feature/add-login)commit-check <version> · Rules reference
Failures open with a count, then a table of only the scopes that failed — every rule ID links to its documentation — with the full tree still one click away:
Commit Check
❌ 2 of 4 checks failed
Show all 4 checks
Scope Checked value Failed checks Commit 2/2 bad msg CC001 message Branch my-changes CC201 branch Commit message ✔ PR title (feat: add login page) ✔ Commit 1/2 (feat: add login page) ✖ Commit 2/2 (1 failure) CC001 message value: bad msg The commit message should follow Conventional Commits. Suggest: Use <type>(<scope>): <description> Branch ✖ Branch (1 failure) CC201 branch value: my-changes The branch should follow Conventional Branch. Suggest: Use <type>/<description> with allowed typescommit-check <version> · Rules reference
A scope is one thing that was checked — a commit message, the branch, the author — not one rule evaluation, so the total matches the ✔/✖ lines you can count and does not grow with the number of rules in your config.
Some runs validate nothing at all — most commonly when the commit author is listed in ignore_authors, which is how Dependabot and other bots are usually exempted. Those runs report ⊘, never ✔:
⊘ All 3 checks skipped — nothing was validated
Show all 3 checksCommit message ⊘ PR title (skipped) ⊘ Commit 1/1 (skipped) Branch ⊘ Branch (skipped)commit-check <version> · Rules reference
A skipped scope carries no checked value, because nothing was examined. When only some scopes skip, the verdict counts them separately — ✅ **3 of 5 checks passed**, 2 skipped — so the headline never claims a pass that did not happen. Failures still take precedence over skips.
This needs commit-check 2.13.4 or newer, which reports "status": "skip" in its JSON. Against an older engine every check is pass or fail as before, and the report is unchanged.
With pr-comments: true the same report is posted as a pull request comment. It is the same Markdown: the job summary and the comment are both rendered by render_report, so the two surfaces cannot disagree. See Success Job Summary and Failure Job Summary above for what it looks like.
What differs is the lifecycle rather than the content:
When a pull request is opened from a forked repository, the GITHUB_TOKEN used by the pull_request event has read-only permissions by design (GitHub security policy). This means pr-comments: true cannot write a comment back to the PR.
By default, commit-check-action handles this gracefully:
For most projects, this is sufficient — contributors can see check results in the action Job Summary. But if you must have PR comments on fork contributions, see the Fork PR Comments documentation for two recommended approaches with ready-to-use workflow examples.
You can add a badge to your repository to show your contributors/users that you use commit-check!
Markdown
[](https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml)
reStructuredText
.. image:: https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml/badge.svg
:target: https://github.com/commit-check/commit-check-action/actions/workflows/commit-check.yml
:alt: Commit Check
Versioning follows Semantic Versioning.
To provide feedback (requesting a feature or reporting a bug), please post to issues or start a discussion.
| Back | FazBrowse Home | New Git URL |