-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (50 loc) · 1.65 KB
/
check.yml
File metadata and controls
54 lines (50 loc) · 1.65 KB
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
53
54
on:
[pull_request]
name: Check
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
lint:
name: Lint and Validate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Validate action.yml
run: |
echo "Validating action.yml syntax..."
node -e "const fs = require('fs'); const yaml = require('js-yaml'); yaml.load(fs.readFileSync('action.yml', 'utf8'));" || echo "Install js-yaml for validation"
conventional-commits:
name: Semantic Pull Request
runs-on: ubuntu-latest
steps:
- name: validate
uses: actions/github-script@v7
with:
script: |
// See https://gist.github.com/marcojahn/482410b728c31b221b70ea6d2c433f0c#file-conventional-commit-regex-md
// Updated to allow multiple scopes like chore(deps)(deps-dev)
const regex = /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))*(!)?:\s+([\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/`
}