Skip to content

Commit e61c9f8

Browse files
authored
build: add Semantic PR check and update mergify conf (#364)
* build: add Semantic PR check and update mergify conf * chore: remove codeql from status check
1 parent d76529f commit e61c9f8

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

.github/workflows/check.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
on:
2-
[pull_request]
1+
on: [pull_request]
32

43
name: Check
54

@@ -8,9 +7,25 @@ jobs:
87
name: Run Unit Tests
98
runs-on: ubuntu-latest
109
steps:
11-
- name: Checkout
12-
uses: actions/checkout@v2
13-
- name: Run tests
14-
run: |
15-
npm ci
16-
npm test
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Run tests
13+
run: |
14+
npm ci
15+
npm test
16+
17+
conventional-commits:
18+
name: Semantic Pull Request
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: validate
22+
uses: actions/github-script@v6
23+
with:
24+
script: |
25+
// See https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c#file-conventional-commit-regex-md
26+
const regex = /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)/g;
27+
const pr = context.payload.pull_request;
28+
const title = pr.title;
29+
if (title.match(regex) == null) {
30+
throw `PR title "${title}"" does not match conventional commits from https://www.conventionalcommits.org/en/v1.0.0/`
31+
}

.mergify.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ queue_rules:
44
# Conditions to get out of the queue (= merged)
55
- status-success=Run Unit Tests
66
- status-success=Semantic Pull Request
7+
- status-success=Analyze (javascript)
78

89
pull_request_rules:
910
- name: Automatically merge on CI success and review approval
@@ -14,6 +15,7 @@ pull_request_rules:
1415
- -approved-reviews-by~=author
1516
- status-success=Run Unit Tests
1617
- status-success=Semantic Pull Request
18+
- status-success=Analyze (javascript)
1719
- label!=work-in-progress
1820
- -title~=(WIP|wip)
1921
- -merged
@@ -30,6 +32,7 @@ pull_request_rules:
3032
- author=dependabot[bot]
3133
- status-success=Run Unit Tests
3234
- status-success=Semantic Pull Request
35+
- status-success=Analyze (javascript)
3336
- -title~=(WIP|wip)
3437
- -label~=(blocked|do-not-merge)
3538
- -merged

0 commit comments

Comments
 (0)