-
Notifications
You must be signed in to change notification settings - Fork 0
26 lines (23 loc) · 1.12 KB
/
pr-title-linter.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
name: PR Title Linter
on:
pull_request:
types: [opened, edited, reopened, unlocked, synchronize]
permissions: read-all
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install commitlint
run: |
npm install @commitlint/config-conventional
npm install commitlint@latest
echo "module.exports = { extends: ['@commitlint/config-conventional'], rules: { 'issue-references': [2, 'always'] }, plugins: [{ rules: { 'issue-references': ({type, references}) => [!(type === 'feat' && references.length === 0), 'Feature must contain issue references'] } } ] };" > commitlint.config.js
- name: "Lint: Pull request title"
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: echo $PR_TITLE | npx commitlint
- name: "Warning: Pull request title must match patterns defined in CONTRIBUTING.md in section Commit Message Guidelines!"
if: ${{ failure() }}
run: echo "Pull request title must match patterns defined in CONTRIBUTING.md in section Commit Message Guidelines!"