-
Notifications
You must be signed in to change notification settings - Fork 0
25 lines (21 loc) · 851 Bytes
/
pr-title-linter.yml
File metadata and controls
25 lines (21 loc) · 851 Bytes
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
name: PR Title Check
on:
pull_request:
types: [opened, edited]
jobs:
lint-pr-title:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check PR Title
uses: actions/[email protected]
with:
script: |
const title = context.payload.pull_request.title;
const regex = /^(feat|fix|chore|docs|style|refactor|perf|test|ci|build|deps|hotfix|env|security)(\([\w\-]+\))?: .+/;
if (!regex.test(title)) {
core.setFailed(`❌ Invalid PR title: "${title}".\n✅ Expected format: type(scope): description\nExamples:\n - feat(docker): preload Hugging Face models\n - fix(api): handle missing auth headers`);
} else {
console.log(`✅ PR title "${title}" is valid.`);
}