Skip to content

Commit a4e497e

Browse files
committed
feat: add commitlint job
Signed-off-by: Andrea Terzolo <andrea.terzolo@suse.com>
1 parent c49bfa9 commit a4e497e

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,33 @@ jobs:
5050
run: |
5151
go mod tidy
5252
make test
53+
commitlint:
54+
runs-on: ubuntu-latest
55+
if: github.event_name == 'pull_request'
56+
env:
57+
COMMITLINT_VERSION: "20.5.0"
58+
steps:
59+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
60+
with:
61+
fetch-depth: 0
62+
persist-credentials: false
63+
- name: Cache commitlint
64+
id: cache-commitlint
65+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
66+
with:
67+
path: |
68+
node_modules
69+
package.json
70+
package-lock.json
71+
key: ${{ runner.os }}-commitlint-${{ env.COMMITLINT_VERSION }}
72+
- name: Install commitlint
73+
if: steps.cache-commitlint.outputs.cache-hit != 'true'
74+
run: npm install -D @commitlint/cli@${{ env.COMMITLINT_VERSION }} @commitlint/config-conventional@${{ env.COMMITLINT_VERSION }}
75+
- name: Print versions
76+
run: |
77+
git --version
78+
node --version
79+
npm --version
80+
npx commitlint --version
81+
- name: Validate PR commits with commitlint
82+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

0 commit comments

Comments
 (0)