Skip to content

Commit 245c4e8

Browse files
committed
Add a commit message checker
1 parent 9a0e19c commit 245c4e8

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/pull-request.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,33 @@ name: Pull requests fosslight_scanner
44

55
on:
66
pull_request:
7-
branches: [ main ]
7+
branches:
8+
- '*'
89

910
jobs:
11+
check-commit-message:
12+
name: Check Commit Message
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Get PR Commits
16+
id: 'get-pr-commits'
17+
uses: tim-actions/get-pr-commits@master
18+
with:
19+
token: ${{ secrets.TOKEN }}
20+
21+
- name: Check Subject Line Length
22+
uses: tim-actions/[email protected]
23+
with:
24+
commits: ${{ steps.get-pr-commits.outputs.commits }}
25+
pattern: '^.{0,50}(\n.*)*$'
26+
error: 'Subject too long (max 50)'
27+
- name: Check Body Line Length
28+
if: ${{ success() || failure() }}
29+
uses: tim-actions/[email protected]
30+
with:
31+
commits: ${{ steps.get-pr-commits.outputs.commits }}
32+
pattern: '^.+(\n.{0,72})*$'
33+
error: 'Body line too long (max 72)'
1034
build:
1135
runs-on: ubuntu-latest
1236
strategy:

0 commit comments

Comments
 (0)