-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (29 loc) · 1.03 KB
/
commit_lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Lint commit message
on: [pull_request]
env:
NODE_VERSION: lts/*
jobs:
lint-commit-message:
runs-on: ubuntu-latest
steps:
- name: Compute number of commits
id: nb-of-commits
run: |
echo "plusOne=$((${{ github.event.pull_request.commits }} + 1))" >> $GITHUB_OUTPUT
echo "minusOne=$((${{ github.event.pull_request.commits }} - 1))" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
fetch-depth: ${{ steps.nb-of-commits.outputs.plusOne }}
persist-credentials: false
- run: git reset HEAD^2
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install required dependencies
run: |
npm install -g @commitlint/cli @commitlint/config-conventional
- name: Validate the first commit message
run: |
commitlint -V --config .github/workflows/commitlint.config.js \
--to HEAD~${{ steps.nb-of-commits.outputs.minusOne }}