Skip to content

Commit 43886d0

Browse files
authored
chore: Add semantic PR check (#220)
1 parent 5aa7864 commit 43886d0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/workflows/check.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,19 @@ jobs:
1414
run: |
1515
npm ci
1616
npm test
17+
18+
conventional-commits:
19+
name: Semantic Pull Request
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: validate
23+
uses: actions/github-script@v6
24+
with:
25+
script: |
26+
// See https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c#file-conventional-commit-regex-md
27+
const regex = /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)/g;
28+
const pr = context.payload.pull_request;
29+
const title = pr.title;
30+
if (title.match(regex) == null) {
31+
throw `PR title "${title}"" does not match conventional commits from https://www.conventionalcommits.org/en/v1.0.0/`
32+
}

0 commit comments

Comments
 (0)