Skip to main content

Conventional Commitlint

PyPI version CI status Downloads codecov License

commitlint is a tool that lints commit messages according to the Conventional Commits standard. It can be used in GitHub Actions and as a pre-commit hook.

Usage

GitHub Actions

If you have an existing workflow, add the following steps:

...
steps:
    ...

    - name: Conventional Commitlint
      uses: opensource-nepal/commitlint@v1

    ...

If you don't have any workflows, create a new GitHub workflow file, e.g., .github/workflows/commitlint.yml:

name: Conventional Commitlint

on:
  push:
    branches: ["main"]
  pull_request:

jobs:
  commitlint:
    runs-on: ubuntu-latest
    name: Conventional Commitlint
    permissions:
      contents: read
      pull-requests: read
    steps:
      - name: Conventional Commitlint
        uses: opensource-nepal/commitlint@v1

Note: The commitlint GitHub Action is triggered only by push, pull_request, or pull_request_target events.

GitHub Action Permissions

The action requires read permission for the following scopes:

  • contents: read : This allows the action to list commits of the repository.
  • pull-requests: read : This allows the action to list the commits in a Pull Request.

For public repositories, these permissions are granted by default. For private repositories, you must explicitly grant them, either in:

Without these, you may encounter an error like:

Github API failed with status code 403. Response: {'message': 'Resource not accessible by integration', 'documentation_url': 'https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request', 'status': '403'}

GitHub Action Inputs

# Name Type Default Description
1 fail_on_error Boolean true Whether the GitHub Action should fail if commitlint detects an issue.
2 verbose Boolean false Enables verbose output.
3 max_header_length Number Optional. Maximum header length to check. If not specified, the header length is not checked.
4 token String secrets.GITHUB_TOKEN GitHub Token for fetching commits using the GitHub API.

GitHub Action Outputs

# Name Type Description
1 exit_code Integer The exit code of the commitlint step.
2 status String The outcome of the commitlint step (success or failure).

Pre-commit

  1. Add the following configuration to .pre-commit-config.yaml:

    repos:
       ...
       - repo: https://github.com/opensource-nepal/commitlint
         rev: v1.3.0
         hooks:
           - id: commitlint
       ...
    
  2. Install the commit-msg hook in your project repository:

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

    Running only pre-commit install will not work.

Note: Avoid using commit messages that start with #, as this may cause unexpected behavior with commitlint.

CLI (Command Line Interface)

For CLI usage, please refer to cli.md.

Contribution

We appreciate feedback and contributions to this package. To get started, please see our contribution guide.

Metadata

Release files for commitlint 2.0.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 commitlint 2.0.0
File Size Uploaded
commitlint-2.0.0.tar.gz 24.6 kB Details

Built distribution (wheel)

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

Total release size: 52.3 kB

Release files / commitlint-2.0.0.tar.gz

Download URL commitlint-2.0.0.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
83ec24f17d87184b4697a8b1d9fe24952888bd40387f8f8c53486584eac960e7
BLAKE2b-256 checksum
How to use checksums
dd683ed72489311b4b0c985dba1c0fa8ef98c1a6a4d9d14fbac28de15c7e2e6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jul 29, 2026.

Transparency log

Release files / commitlint-2.0.0-py3-none-any.whl

Download URL commitlint-2.0.0-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3aa539348393bc5e1f346e41bb9a6eb42b20763df8d0d528eaf1b29284c2510
BLAKE2b-256 checksum
How to use checksums
967e224f9ba092d1374869c512f49b4e30905424867d70a7f4dede7f44cf8f5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jul 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.13.3

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.2.1

2 release files

0.2.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