-
Notifications
You must be signed in to change notification settings - Fork 50
53 lines (44 loc) · 1.51 KB
/
Copy pathcommitlint.yml
File metadata and controls
53 lines (44 loc) · 1.51 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
name: commitlint
# Validate Conventional Commits (ADR-0002) with commitlint as the SINGLE engine,
# on both the PR commits and the PR title (the squash-merge subject that feeds
# release-please). Only official actions/* + the @commitlint/* packages — no
# third-party actions (supply-chain hardening; Phase 4/5 orientation).
on:
pull_request:
branches:
- master
types:
- opened
- edited
- synchronize
- reopened
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
commitlint:
runs-on: ubuntu-22.04
steps:
# TODO(supply-chain): pin actions to commit SHA — via Renovate digest
# pinning once #122 lands, or provide the SHAs to pin manually (ADR-0002 / #99).
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install commitlint
run: npm install --no-save @commitlint/cli @commitlint/config-conventional
- name: Lint PR commits
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: npx commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --verbose
- name: Lint PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: printf '%s' "$PR_TITLE" | npx commitlint --verbose