-
Notifications
You must be signed in to change notification settings - Fork 144
35 lines (33 loc) · 1.03 KB
/
check.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
on:
[pull_request]
name: Check
jobs:
check:
name: Run Unit Tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: 20
- name: Run tests
run: |
npm ci
npm test
conventional-commits:
name: Semantic Pull Request
runs-on: ubuntu-22.04
steps:
- name: validate
uses: actions/github-script@v7
with:
script: |
// See https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c#file-conventional-commit-regex-md
const regex = /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)/g;
const pr = context.payload.pull_request;
const title = pr.title;
if (title.match(regex) == null) {
throw `PR title "${title}"" does not match conventional commits from https://www.conventionalcommits.org/en/v1.0.0/`
}