commitlint is a pre-commit hook designed to lint your commit messages according to the Conventional Commits standard.
Project description
Conventional Commitlint
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.yaml:
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
commitlintGitHub Action is triggered only bypush,pull_request, orpull_request_targetevents.
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 | 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
-
Add the following configuration to
.pre-commit-config.yaml:repos: ... - repo: https://github.com/opensource-nepal/commitlint rev: v1.3.0 hooks: - id: commitlint ...
-
Install the
commit-msghook in your project repository:pre-commit install --hook-type commit-msg
Running only
pre-commit installwill not work.
Note: Avoid using commit messages that start with
#, as this may cause unexpected behavior withcommitlint.
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commitlint-1.13.3.tar.gz.
File metadata
- Download URL: commitlint-1.13.3.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e92522e064010ae85b825b73923760c0e4ff34954859fec4976f3e86a342ea30
|
|
| MD5 |
b674b6610484e1f1bd33aa616eb966e6
|
|
| BLAKE2b-256 |
7a00e2dcd72cd76969b74e811ed06506183b00f9dd0e0f308a4f3672300a32a2
|
Provenance
The following attestation bundles were made for commitlint-1.13.3.tar.gz:
Publisher:
release-please.yml on opensource-nepal/commitlint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
commitlint-1.13.3.tar.gz -
Subject digest:
e92522e064010ae85b825b73923760c0e4ff34954859fec4976f3e86a342ea30 - Sigstore transparency entry: 813638344
- Sigstore integration time:
-
Permalink:
opensource-nepal/commitlint@b475c5486b51a090474c55a8dd2eafc84bcd84ba -
Branch / Tag:
refs/heads/main - Owner: https://github.com/opensource-nepal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@b475c5486b51a090474c55a8dd2eafc84bcd84ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file commitlint-1.13.3-py3-none-any.whl.
File metadata
- Download URL: commitlint-1.13.3-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
330a9aa892b0bca9d671c5cd059755d9d48468f35095efe1be09ba667085b3f7
|
|
| MD5 |
5f87430b77ee5ddfa7f5615d059ee5d3
|
|
| BLAKE2b-256 |
e08aa524c54aa6a8c712ddea2da6ffbbdde93c2c4eeb8121cae2a43e266c1cea
|
Provenance
The following attestation bundles were made for commitlint-1.13.3-py3-none-any.whl:
Publisher:
release-please.yml on opensource-nepal/commitlint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
commitlint-1.13.3-py3-none-any.whl -
Subject digest:
330a9aa892b0bca9d671c5cd059755d9d48468f35095efe1be09ba667085b3f7 - Sigstore transparency entry: 813638345
- Sigstore integration time:
-
Permalink:
opensource-nepal/commitlint@b475c5486b51a090474c55a8dd2eafc84bcd84ba -
Branch / Tag:
refs/heads/main - Owner: https://github.com/opensource-nepal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@b475c5486b51a090474c55a8dd2eafc84bcd84ba -
Trigger Event:
push
-
Statement type: