Github action for validating commit messages.
Note that this is an opinionated package, following wholly arbitrary preferences.
You can save the following in your repo as /.github/workflows/validate-commit-message.yml
:
on: push
name: Validate commit message
jobs:
build:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Validate
uses: harmenjanssen/commit-message-validation-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
This action performs the following checks on every commit message:
- Commit message should start with an uppercase letter.
- Subject line should not exceed 72 characters.
- Commit should start with an imperative verb.
- Commit message should not contain rebase instructions like
!fixup
or!squash
.
Examples of valid commit messages are:
Add colorpicker to admin interface
Update README.md
Remove deprecated function
Pull Requests are welcome!
Please make sure the tests pass and add a test that shows which problem your contribution is solving.
Run the tests using
$ npm run test
To build your changes run:
$ npm run build
Commit the changes in dist
.