forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 2
32 lines (28 loc) · 908 Bytes
/
Copy pathvalidate-commit.yml
File metadata and controls
32 lines (28 loc) · 908 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
26
27
28
29
30
31
32
name: Validate Commit Messages
on:
pull_request:
branches:
- '**'
jobs:
validate-commit-messages:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Validate commit messages
run: |
commit_msg=$(git show -s --format=%s)
commit_regex='^\[#(noissue|[0-9]+?)\].*'
error_msg="Commit message does not follow the Conventional Commits format:
[#issue-number] messge
Examples:
[#1001] Refactor servermap
[#noissue] Update README.md"
if ! echo "${commit_msg}" | grep -Eq "$commit_regex"; then
echo "$error_msg"
echo "Invalid commit message: \"${commit_msg}\""
exit 1
fi