-
Notifications
You must be signed in to change notification settings - Fork 9
41 lines (34 loc) · 1.18 KB
/
commitlint.yml
File metadata and controls
41 lines (34 loc) · 1.18 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
name: cohort360-frontend-commitlint
on:
pull_request:
branches:
- develop
- main
types: [opened, synchronize, reopened, ready_for_review, edited]
permissions:
contents: read
pull-requests: read
jobs:
commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Install commit-lint
run: |
npm install --ignore-scripts --force conventional-changelog-conventionalcommits @commitlint/config-conventional commitlint@latest
- name: Fix commitlint error
run: |
sed -i 's/"type": "module",//g' package.json
- 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")
npx commitlint --from "$FROM" --to "$HEAD_SHA" --verbose
- name: Validate PR title with commitlint
run: |
echo "${{ github.event.pull_request.title }}" | npx commitlint