-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (40 loc) · 1.68 KB
/
pr.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
# This file is synced with stordco/common-config-elixir. Any changes will be overwritten.
name: PR
on:
merge_group:
pull_request:
types:
- edited
- opened
- reopened
- synchronize
jobs:
Title:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Check
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const title = context.payload?.pull_request?.title;
if (typeof title !== 'string') {
core.info("Pull request data not in payload. Skipping PR title check.");
return;
}
const REGEX = /^(feat!|fix!|hotfix!|fix|feat|chore|hotfix|(fix|feat|chore|hotfix)\(\w.*\)):\s(\[\w{1,8}-\d{1,8}\]|.*).*/;
if (!REGEX.test(title)) {
core.setFailed("Pull request title does not follow conventional commits");
console.log(`
Pull Request title "${title}" does not follow our [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) naming scheme.
Please try renaming the PR to match one of these examples:
chore: a small insignificant change
fix: [JIRA-1234] fix an existing feature
feat: [JIRA-1234] a new feature to release
feat!: a breaking change
hotfix: needed in production immediately
Adding ! (i.e. \`feat!:\`) represents a breaking change and will result in a SemVer major release.
Starting a commit with \`hotfix\` will result in a seperate hotfix release PR.
`.trim());
}