Repository navigation
61 lines (51 loc) · 1.74 KB
/
Copy pathcommitlint.yml
File metadata and controls
61 lines (51 loc) · 1.74 KB
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 checks
on:
push:
branches:
- main
paths-ignore:
- "data/**"
pull_request:
branches:
- main
types:
- opened
- edited
- synchronize
- reopened
concurrency:
group: commitlint-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
commitlint:
if: >-
(github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]')
|| (github.event_name == 'push' && github.event.head_commit.author.name != 'dependabot[bot]')
runs-on: ubuntu-latest
steps:
- name: Enforce single-commit PRs
if: github.event_name == 'pull_request'
env:
PR_COMMIT_COUNT: ${{ github.event.pull_request.commits }}
run: test "$PR_COMMIT_COUNT" -eq 1
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Set up Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"
package-manager-cache: false
- name: Install commitlint
run: npm install --ignore-scripts --no-save --no-package-lock @commitlint/cli@21.2.3 @commitlint/config-conventional@21.2.3
- name: Validate PR title
if: github.event_name == 'pull_request'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: printf '%s\n' "$PR_TITLE" | ./node_modules/.bin/commitlint --verbose
- name: Validate last commit
run: ./node_modules/.bin/commitlint --last --verbose