Action to check if the commit follows proper guidelines as specified here
Create a workflow .yml
file in your repositories .github/workflows
directory
(eg. .github/workflows/check-commit.yml
). In your workflow you first need to checkout
your repository then use this action.
Refer to the example below,
name: Check Commit Message
on: [pull_request, push]
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
- name: Check commit 🧪
uses: adityaa30/check-commit@master
-
compulsory-scope
- Either 'true' or 'false'
- Defaults to 'false'
- If true, scope field becomes compulsory for each commit (refer here)
-
max-header-length
- Should be a valid non-zero positive integer
- Defaults to 50
- Raises an error if length of commit header is more than specified
Fork the repository
# Clone the forked repository
git clone https://github.com/<git-username>/check-commit.git
# Enter project directory
cd check-commit
# Install dependencies
npm install
# Build the project
npm run build
- Before pushing any changes, please build the project to update the
dist/index.js
in order to reflect your changes in github - To test the project in your local use act
- Get the commit message
- Implement rules based on syntax defined here
- Helper functions to check commit message based on rules
- Add input parameter
compulsory-scope
- Add input parameter
max-header-length
- Add a CLI
- Add custom input parameters