-
Notifications
You must be signed in to change notification settings - Fork 96
73 lines (60 loc) · 1.68 KB
/
commitlint.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
62
63
64
65
66
67
68
69
70
71
72
# This workflow will validate the title of a PR to ensure it meets conventional commit standards
name: Validate conventional commit syntax
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
pull_request_review:
types:
- submitted
permissions:
pull-requests: read
# Separate jobs can run concurrently
jobs:
prTitle:
name: Validate conventional commit format for title
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci --prefer-offline
- run: npm i @commitlint/load
- id: prlint
uses: kevintyj/prlint@v2
- id: comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: commitlint
message: |
## ${{ steps.prlint.outputs.lint-status }}
<details><summary>More Info</summary>
```json
${{ toJSON(fromJSON(steps.prlint.outputs.lint-details)) }}
```
</details>
- uses: actions/github-script@v7
env:
PR_TITLE_VALID: ${{ fromJSON(steps.prlint.outputs.lint-details).valid }}
PR_LINT_STATUS: ${{ steps.prlint.outputs.lint-status }}
with:
script: |
const { PR_LINT_STATUS, PR_TITLE_VALID } = process.env;
if (PR_TITLE_VALID.toString() !== 'true')
core.setFailed(PR_LINT_STATUS);