-
Notifications
You must be signed in to change notification settings - Fork 14
61 lines (50 loc) · 1.61 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Commit Lint
on:
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
HUSKY: 0
jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
ref: main
- name: Setup Node.js
if: steps.changes.outputs.ts == 'true'
uses: actions/setup-node@v4
with:
node-version: 18.0.0
cache: npm
- name: Restore node_modules cache
id: deps-cache
uses: martijnhols/actions-cache/restore@v3
with:
path: node_modules
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Fetch other branches for commitlint
run: git fetch --prune --unshallow
- name: Validate PR commits with commitlint
id: commitlint
continue-on-error: true
run: |
output=$(npm run commitlint ${1} 2>&1) || true
echo "::set-output name=results::$output"
- name: Create comment
if: steps.commitlint.outputs.results
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ steps.commitlint.outputs.results }}
- name: Cache node modules
if: steps.deps-cache.outputs.cache-hit != 'true'
uses: martijnhols/actions-cache/save@v3
with:
path: node_modules
key: ${{ runner.os }}-build-ts-deps-cache-${{ hashFiles('ts/package-lock.json') }}