1 |
name: Commitlint |
2 |
|
3 |
on: [push, pull_request] |
4 |
|
5 |
jobs: |
6 |
commitlint: |
7 |
runs-on: ubuntu-latest |
8 |
if: ${{ github.actor != 'dependabot[bot]' }} |
9 |
steps: |
10 |
- uses: actions/checkout@v4 |
11 |
with: |
12 |
fetch-depth: 0 |
13 |
|
14 |
- name: Install required dependencies |
15 |
run: | |
16 |
sudo apt update |
17 |
sudo apt install -y git curl |
18 |
curl -sL https://deb.nodesource.com/setup_22.x | sudo -E bash - |
19 |
sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs |
20 |
|
21 |
- name: Print versions |
22 |
run: | |
23 |
git --version |
24 |
node --version |
25 |
npm --version |
26 |
npx commitlint --version |
27 |
|
28 |
- name: Install commitlint |
29 |
run: | |
30 |
npm install conventional-changelog-conventionalcommits |
31 |
npm install commitlint@latest |
32 |
|
33 |
- name: Validate current commit (last commit) with commitlint |
34 |
if: github.event_name == 'push' |
35 |
run: npx commitlint --last --verbose |
36 |
|
37 |
- name: Validate PR commits with commitlint |
38 |
if: github.event_name == 'pull_request' |
39 |
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose |