Repository navigation
57 lines (48 loc) · 1.72 KB
/
Copy pathcommitlint.yml
File metadata and controls
57 lines (48 loc) · 1.72 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
name: CommitLint
on:
pull_request:
branches: [main]
types: [opened, edited, reopened, synchronize]
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
jobs:
commitlint:
name: CommitLint
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm ci
- name: Lint pull request title
id: lint
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: echo "$PR_TITLE" | npx commitlint
- name: Find comment
id: find
if: always()
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: <a name="commitlint-workflow"></a>
- name: Failure comment
if: failure()
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
<a name="commitlint-workflow"></a>❌ Your pull request title does not follow the conventional commit standard enforced by the project. It must begin with one of the emoji from the [gitmoji](https://gitmoji.dev) set appropriate for the change(s) being made, and it must be lowercase.
- name: Delete comment
if: steps.find.outputs.comment-id != 0
uses: detomarco/delete-comments@1.1.0
with:
comment-id: ${{ steps.find.outputs.comment-id }}