Lints Pull Request commits with commitlint
Create a github workflow in the .github
folder, e.g. .github/workflows/commitlint.yml
:
name: Commitlint
on: [pull_request]
jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v1
Alternatively, you can run on other event types such as on: [push]
. In that case the action will lint the push event's commit(s) instead of linting commits from a pull request. You can also combine push
and pull_request
together in the same workflow.
Note: It's necessary that you specify the fetch-depth
argument to actions/checkout@v2
step. By default they fetch only latest commit of the branch, but we need more commits since we validate a range of commit messages.
The path to your commitlint config file.
Default: commitlint.config.js
When set to true, we follow only the first parent commit when seeing a merge commit.
This helps to ignore errors in commits that were already present in your default branch (e.g. master
) before adding conventional commit checks. More info in git-log docs.
Default: true
Whether you want to fail on warnings or not.
Default: false
Link to a page explaining your commit message convention.
default: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
This is a Docker
action, and was made like this so that you can run it with minimum setup, regardless of your repo's environment. It comes packed with the most famous shared configurations that you can use in your commitlint config's extends
field:
- @commitlint/config-angular
- @commitlint/config-conventional
- @commitlint/config-lerna-scopes
- @commitlint/config-patternplate
- conventional-changelog-lint-config-canonical
- commitlint-config-jira
If you have a custom shared config that lies in a private registry, let us know! We will be happy to cover this case if necessary.