-
Notifications
You must be signed in to change notification settings - Fork 10
80 lines (71 loc) · 2.84 KB
/
pr-title-check.yml
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
68
69
70
71
72
73
74
75
76
77
78
79
80
name: "Lint PR"
on:
pull_request_target:
types: [opened, edited, reopened, synchronize, labeled, unlabeled]
# IMPORTANT: No checkout actions, scripts, or builds should be added to this workflow. Permissions should always be used
# with extreme caution. https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
permissions:
pull-requests: write
contents: read
# PR updates can happen in quick succession leading to this
# workflow being trigger a number of times. This limits it
# to one run per PR.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
validate:
name: Validate PR Title
runs-on: ubuntu-latest
outputs:
success: ${{ steps.check.outputs.success }}
steps:
- name: PR Title Check
uses: thehanimo/[email protected]
id: check
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
configuration_path: ".github/pr-title-checker-config.json"
fail:
name: PR Title Check Failed
runs-on: ubuntu-latest
needs: validate
if: ${{ always() && needs.validate.outputs.success == 'false'}}
steps:
- name: Add comment to fix PR title
uses: marocchino/sticky-pull-request-comment@v2
with:
header: 'PR Title Check'
recreate: true
message: |
### 🚨 PR Title Needs Formatting
The title of this PR needs to be formatted correctly.
Please update the title to match the format `type: description AB#xxx`. Examples:
* `fix: fix typo in README.md AB#123`
* `chore: update dependencies AB#456`
* `feat: add new feature AB#789`
* `chore: fixing build pipeline` - no AB reference
* `build(deps): bump BlahBlah from 1.0 to 1.1`
* `[wip] feat: add new feature AB#123`
* `[cherry-pick] fix: fix typo in README.md AB#123`
* `[backport] fix: fix typo in README.md AB#123`
For more details, please refer to the [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0)
and the [PR Title Configuration File](.github/pr-title-checker-config.json).
- name: Set action status to failed
run: |
echo "❌ PR Title Check Failed"
exit 1
success:
name: PR Title Check Passed
runs-on: ubuntu-latest
needs: validate
if: ${{ always() && needs.validate.outputs.success == 'true' }}
steps:
- name: Add comment that PR title is fixed
uses: marocchino/sticky-pull-request-comment@v2
with:
header: 'PR Title Check'
recreate: true
message: |
### ✅ PR Title Formatted Correctly
The title of this PR has been updated to match the correct format. Thank you!