chore: add a workflow to lint commit messages in CI #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint Commit Messages | ||
on: | ||
push: | ||
branches-ignore: | ||
- dependabot/** | ||
jobs: | ||
commitlint: | ||
name: Check Commit Messages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
- name: Install Commitlint | ||
run: | | ||
npm install conventional-changelog-conventionalcommits | ||
npm install commitlint@latest | ||
- name: Validate Current Commit (Last Commit) With Commitlint | ||
if: github.event_name == "push" | ||
Check failure on line 22 in .github/workflows/commitlint.yml GitHub Actions / Lint Commit MessagesInvalid workflow file
|
||
run: | | ||
npx commitlint --from HEAD~1 --to HEAD --verbose | ||
- name: Validate PR Commits With Commitlint | ||
if: github.event_name == "pull_request" | ||
run: | ||
npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ | ||
github.event.pull_request.commits }} --to ${{ | ||
github.event.pull_request.head.sha }} --verbose |