-
Notifications
You must be signed in to change notification settings - Fork 38
58 lines (56 loc) · 1.83 KB
/
pull-request-lint.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
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
name: pull-request-lint
on:
pull_request_target:
types:
- labeled
- opened
- synchronize
- reopened
- ready_for_review
- edited
jobs:
validate:
name: Validate PR title
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: amannn/action-semantic-pull-request@v5.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |-
build
chore
ci
docs
feat
fix
style
refactor
perf
test
requireScope: false
contributorStatement:
name: Require Contributor Statement
runs-on: ubuntu-latest
permissions:
pull-requests: read
env:
PR_BODY: ${{ github.event.pull_request.body }}
EXPECTED: |-
*By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.*
HELP: Contributor statement missing from PR description. Please include the following text in the PR description
if: "!(github.event.pull_request.user.login == 'amazon-auto' || github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'github-actions')"
steps:
- uses: actions/github-script@v6
with:
script: |-
const actual = process.env.PR_BODY.replace(/\r?\n/g, "\n");
const expected = process.env.EXPECTED.replace(/\r?\n/g, "\n");
if (!actual.includes(expected)) {
console.log("%j", actual);
console.log("%j", expected);
core.setFailed(`${process.env.HELP}: ${expected}`);
}