Skip to main content

coauthorcheck logo

coauthorcheck

Lightweight command-line validation for Co-authored-by commit trailers.

CI PyPI version Supported Python versions License

Table of Contents

Usage

coauthorcheck works in any Git repository, regardless of the project's language or build system. You can use coauthorcheck in one of these three ways:

  • as a pre-commit commit-msg hook for immediate local feedback
  • in GitHub Actions to validate branch or pull request commits before merge
  • directly from CLI

pre-commit

Add this to .pre-commit-config.yaml:

repos:
  - repo: https://github.com/simoncraf/coauthorcheck
    rev: v0.7.0
    hooks:
      - id: coauthorcheck
        stages: [commit-msg]

Then install the hook:

pre-commit install --hook-type commit-msg

This is required because coauthorcheck validates the final commit message file, and commit-msg is the Git hook that receives that file.

GitHub Actions

The easiest GitHub integration is the reusable composite action:

- uses: simoncraf/coauthorcheck-action@v0.2.0
  with:
    range: origin/main..HEAD

You can also install it from GitHub Marketplace: coauthorcheck Marketplace Action

Validate commits introduced by branch pushes:

name: Validate Co-authored-by trailers

on:
  push:
    branches:
      - "feature/**"
      - "feat/**"

jobs:
  validate-commits:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Validate branch commits
        uses: simoncraf/coauthorcheck-action@v0.2.0
        with:
          range: origin/main..HEAD

Validate commits introduced by a pull request:

name: Validate Co-authored-by trailers on PR

on:
  pull_request:
    branches:
      - main

jobs:
  validate-commits:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Validate PR commits
        uses: simoncraf/coauthorcheck-action@v0.2.0
        with:
          range: origin/${{ github.base_ref }}..HEAD

See docs/integrations.md for local hooks, JSON output, PR comments, and more workflow examples.

When validation fails, coauthorcheck also prints a suggested corrected trailer line. If multiple issues affect the same trailer, they are merged into one canonical fix suggestion.

CLI

coauthorcheck .git/COMMIT_EDITMSG
coauthorcheck HEAD
coauthorcheck HEAD~5..HEAD
coauthorcheck main..HEAD
coauthorcheck origin/main..HEAD

coauthorcheck --file .git/COMMIT_EDITMSG
coauthorcheck --commit HEAD
coauthorcheck --range HEAD~5..HEAD

Positional input is auto-detected in this order:

  • values containing .. or ... are treated as commit ranges
  • existing paths are treated as commit message files
  • everything else is treated as a commit ref

Use the explicit flags when you want fully unambiguous scripting.

Check the installed CLI:

coauthorcheck --help

Installation

Install from PyPI:

pip install coauthorcheck

Or with uv:

uv tool install coauthorcheck

Or with pipx:

pipx install coauthorcheck

After installation, run:

coauthorcheck --help

Common CLI Workflows

Validate the commit message currently being edited:

coauthorcheck .git/COMMIT_EDITMSG

Validate only the commits introduced by your current branch compared with main:

coauthorcheck main..HEAD

Validate only the commits introduced by your branch compared with the remote default branch:

coauthorcheck origin/main..HEAD

Validate the last few commits on the current branch:

coauthorcheck HEAD~3..HEAD

Configuration

coauthorcheck supports repository-local configuration from either:

  • pyproject.toml under [tool.coauthorcheck]
  • .coauthorcheck.toml

Configuration is resolved in this order:

  1. --config <path>
  2. nearest .coauthorcheck.toml
  3. nearest pyproject.toml with [tool.coauthorcheck]
  4. built-in defaults

When config files are auto-discovered, coauthorcheck searches upward from the current working directory. This means running the tool from a nested folder in the repo still finds the repo-level config.

Example using pyproject.toml:

[tool.coauthorcheck.rules]
name_parts = "warning"
github_handle = "warning"
incorrect_casing = "error"
invalid_format = "error"
malformed_email = "error"
missing_email = "error"
missing_name = "error"
email_domain = "error"

[tool.coauthorcheck.policy]
minimum_name_parts = 2
allowed_email_domains = ["example.com"]
blocked_email_domains = ["users.noreply.github.com"]
allow_github_noreply = false
ignore_bots = false

Example using .coauthorcheck.toml:

[rules]
name_parts = false
github_handle = "warning"
incorrect_casing = "error"
invalid_format = "error"
malformed_email = "error"
missing_email = "error"
missing_name = "error"
email_domain = "error"

[policy]
minimum_name_parts = 1
allowed_email_domains = ["example.com"]
blocked_email_domains = ["users.noreply.github.com"]
allow_github_noreply = true
ignore_bots = true

Use an explicit config file with:

coauthorcheck --config .coauthorcheck.toml main..HEAD

Rule values can be:

  • false: disable the rule
  • true or "error": enable the rule as an error
  • "warning": enable the rule as a warning

email_domain is a special policy rule. If you enable it, you must also configure allowed_email_domains, blocked_email_domains, allow_github_noreply, or a combination of them under [tool.coauthorcheck.policy] in pyproject.toml or under [policy] in .coauthorcheck.toml.

name_parts uses the minimum_name_parts policy value. The default is 2, which preserves the current "first and last name" behavior. Set minimum_name_parts = 1 to relax the rule, or a higher value such as 3 to require more name parts.

ignore_bots skips validation for commits authored by bot accounts and for bot-style Co-authored-by names such as dependabot[bot].

Example:

[tool.coauthorcheck.rules]
email_domain = "warning"
name_parts = "error"

[tool.coauthorcheck.policy]
minimum_name_parts = 3
allowed_email_domains = ["example.com", "company.com"]
blocked_email_domains = ["users.noreply.github.com"]
allow_github_noreply = false
ignore_bots = true

With that configuration:

  • co-author names must contain at least three parts
  • emails from the listed domains are allowed
  • emails from blocked domains are rejected
  • GitHub noreply addresses are explicitly rejected
  • bot-authored commits and bot-style coauthors are skipped entirely
  • emails from other domains produce an email-domain issue
  • if exactly one allowed domain is configured, coauthorcheck can suggest a corrected email domain
  • enabling email_domain without allowed_email_domains, blocked_email_domains, or allow_github_noreply is a configuration error

Only error-level issues fail the command with exit code 1. Warnings are reported but do not fail the run.

Unknown rule names or invalid values are treated as configuration errors.

See docs/rules.md for a detailed explanation of each rule. See docs/policies.md for the distinction between rules and policies, and for policy-specific settings. See docs/integrations.md for pre-commit, GitHub Actions, JSON output, and PR comment examples. Use coauthorcheck --format json ... for machine-readable output in CI and automation. JSON issue objects also include a suggestion field when a corrected trailer can be proposed.

Development

Set up the local environment:

uv sync

Run the CLI from the project environment:

uv run coauthorcheck --help

Run the tool from another repository by changing into that repository first and then invoking the executable from this project:

cd /path/to/other-repo
/path/to/coauthorcheck/.venv/Scripts/coauthorcheck.exe main..HEAD

In Git Bash, use /c/... style paths:

/path/to/coauthorcheck/.venv/Scripts/coauthorcheck.exe main..HEAD

Run the test suite:

uv run pytest

Run the linter:

uv run ruff check .

Metadata

Release files for coauthorcheck 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coauthorcheck 0.7.0
File Size Uploaded
coauthorcheck-0.7.0.tar.gz 17.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coauthorcheck 0.7.0
File Interpreter ABI Platform
coauthorcheck-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.4 kB

Release files / coauthorcheck-0.7.0.tar.gz

Download URL coauthorcheck-0.7.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
10368527d6e8bac305f3839e881c7e7c320ee48118b062e9792d04267130dcad
BLAKE2b-256 checksum
How to use checksums
10362dfbd3522b803cbf6238ee33d8e66edb1a71bc2b31855e54ae8a0d1a2e90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 16, 2026.

Transparency log

Release files / coauthorcheck-0.7.0-py3-none-any.whl

Download URL coauthorcheck-0.7.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0281f672b4a6af07cbfd0047fb6737eaa5ef80ec9c1472db56f6689f2347068b
BLAKE2b-256 checksum
How to use checksums
35ec3e2bab4ff1d540ddb08670364ca2ef69fc02dfb85f348dba6e497ee0ea6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page