-
Notifications
You must be signed in to change notification settings - Fork 10
37 lines (32 loc) · 1.06 KB
/
Copy pathcommitlint.yml
File metadata and controls
37 lines (32 loc) · 1.06 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
name: cohort360-frontend-commitlint
on:
pull_request:
branches:
- develop
- main
types: [opened, synchronize, reopened, ready_for_review, edited]
jobs:
commit-lint:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Install dependencies
run: npm ci --no-audit --ignore-scripts
- name: Validate PR commits with commitlint
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
git fetch origin "$BASE_REF"
FROM=$(git merge-base "origin/$BASE_REF" "$HEAD_SHA")
./node_modules/.bin/commitlint --from "$FROM" --to "$HEAD_SHA" --verbose
- name: Validate PR title with commitlint
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
printf '%s\n' "$PR_TITLE" | ./node_modules/.bin/commitlint