|
| 1 | +name: Semantic PR Check |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, edited] |
| 6 | + |
| 7 | +jobs: |
| 8 | + pr-title-check: |
| 9 | + runs-on: ubuntu-18.04 |
| 10 | + steps: |
| 11 | + - name: PR title is valid |
| 12 | + if: > |
| 13 | + startsWith(github.event.pull_request.title, 'feat:') || startsWith(github.event.pull_request.title, 'feat(') || |
| 14 | + startsWith(github.event.pull_request.title, 'fix:') || startsWith(github.event.pull_request.title, 'fix(') || |
| 15 | + startsWith(github.event.pull_request.title, 'perf:') || startsWith(github.event.pull_request.title, 'perf(') || |
| 16 | + startsWith(github.event.pull_request.title, 'docs:') || startsWith(github.event.pull_request.title, 'docs(') || |
| 17 | + startsWith(github.event.pull_request.title, 'test:') || startsWith(github.event.pull_request.title, 'test(') || |
| 18 | + startsWith(github.event.pull_request.title, 'refactor:') || startsWith(github.event.pull_request.title, 'refactor(') || |
| 19 | + startsWith(github.event.pull_request.title, 'style:') || startsWith(github.event.pull_request.title, 'style(') || |
| 20 | + startsWith(github.event.pull_request.title, 'build:') || startsWith(github.event.pull_request.title, 'build(') || |
| 21 | + startsWith(github.event.pull_request.title, 'ci:') || startsWith(github.event.pull_request.title, 'ci(') || |
| 22 | + startsWith(github.event.pull_request.title, 'chore:') || startsWith(github.event.pull_request.title, 'chore(') || |
| 23 | + startsWith(github.event.pull_request.title, 'revert:') || startsWith(github.event.pull_request.title, 'revert(') |
| 24 | + run: | |
| 25 | + echo 'Title checks passed' |
| 26 | +
|
| 27 | + - name: PR title is invalid |
| 28 | + if: > |
| 29 | + !startsWith(github.event.pull_request.title, 'feat:') && !startsWith(github.event.pull_request.title, 'feat(') && |
| 30 | + !startsWith(github.event.pull_request.title, 'fix:') && !startsWith(github.event.pull_request.title, 'fix(') && |
| 31 | + !startsWith(github.event.pull_request.title, 'perf:') && !startsWith(github.event.pull_request.title, 'perf(') && |
| 32 | + !startsWith(github.event.pull_request.title, 'docs:') && !startsWith(github.event.pull_request.title, 'docs(') && |
| 33 | + !startsWith(github.event.pull_request.title, 'test:') && !startsWith(github.event.pull_request.title, 'test(') && |
| 34 | + !startsWith(github.event.pull_request.title, 'refactor:') && !startsWith(github.event.pull_request.title, 'refactor(') && |
| 35 | + !startsWith(github.event.pull_request.title, 'style:') && !startsWith(github.event.pull_request.title, 'style(') && |
| 36 | + !startsWith(github.event.pull_request.title, 'build:') && !startsWith(github.event.pull_request.title, 'build(') && |
| 37 | + !startsWith(github.event.pull_request.title, 'ci:') && !startsWith(github.event.pull_request.title, 'ci(') && |
| 38 | + !startsWith(github.event.pull_request.title, 'chore:') && !startsWith(github.event.pull_request.title, 'chore(') && |
| 39 | + !startsWith(github.event.pull_request.title, 'revert:') && !startsWith(github.event.pull_request.title, 'revert(') |
| 40 | + run: | |
| 41 | + echo 'Pull request title is not valid. Please check github.com/amplitude/Amplitude-JavaScript/blob/main/CONTRIBUTING.md#pr-commit-title-conventions' |
| 42 | + exit 1 |
0 commit comments