-
Notifications
You must be signed in to change notification settings - Fork 1.4k
67 lines (59 loc) · 1.64 KB
/
pr-lint.yaml
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
58
59
60
61
62
63
64
65
66
67
name: "Lint PR"
on:
pull_request:
types:
- opened
- edited
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
dependency-check:
name: Validate Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: CI Setup
uses: ./.github/actions/ci-setup
- name: Validate Dependencies
run: pnpm depcheck
validate-pr:
name: Validate PR content
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
chore
build
docs
ci
rc
- name: Check PR title length
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
title_length=${#TITLE}
if [ $title_length -gt 72 ]
then
echo "PR title is too long (greater than 72 characters)"
exit 1
fi
- name: Verify PR has breaking changes section
if: contains(github.event.pull_request.title, '!')
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
if [[ "${PR_BODY}" != *"# Breaking Changes"*"# Checklist"* ]]; then
echo "This is a breaking change PR."
echo "Please add a '# Breaking Changes' section in the PR's body before the '# Checklist' section."
exit 1
fi