-
Notifications
You must be signed in to change notification settings - Fork 77
47 lines (38 loc) · 1.36 KB
/
Copy pathcommitlint.yml
File metadata and controls
47 lines (38 loc) · 1.36 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
name: Commitlint
on:
pull_request:
types: [opened, edited, synchronize]
branches: [master]
push:
branches: [master]
permissions:
contents: read
concurrency:
group: commitlint-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch PR commits (no checkout of PR code)
if: github.event_name == 'pull_request'
run: |
git fetch origin +refs/pull/${{ github.event.number }}/head:refs/remotes/origin/pr/${{ github.event.number }}
# sanity: ensure head sha is present locally
git rev-parse --verify ${{ github.event.pull_request.head.sha }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install commitlint dependencies
run: |
bun add -d @commitlint/cli@^20.1.0 commitlint-config-gitmoji@^2.3.1
- name: Validate current commit (push)
if: github.event_name == 'push'
run: |
bunx commitlint --from HEAD~1 --to HEAD --verbose
- name: Validate PR commits
if: github.event_name == 'pull_request'
run: bunx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose