File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change 12
12
validate-commit-messages :
13
13
runs-on : ubuntu-22.04
14
14
steps :
15
- - name : Checkout code
16
- uses : actions/checkout@v4
17
-
18
15
- name : Validate commit messages
16
+ env :
17
+ COMMIT : ${{ github.event.workflow_run.head_commit.message }}
19
18
run : |
20
19
# Define the regex for Conventional Commits
21
20
commit_regex='^\[#(noissue|[0-9]+?)\].*'
25
24
[#1001] Refactor servermap
26
25
[#noissue] Update README.md"
27
26
28
- # Get the commit messages
29
- commits=$(git log --format=%s origin/main..HEAD)
30
-
31
27
# Validate each commit message
32
- for commit in $commits; do
33
- if ! echo "$commit" | grep -Eq "$commit_regex"; then
34
- echo "$error_msg"
35
- echo "Invalid commit message: $commit"
36
- exit 1
37
- fi
38
- done
28
+ if ! echo "${COMMIT}" | grep -Eq "$commit_regex"; then
29
+ echo "$error_msg"
30
+ echo "Invalid commit message: $commit"
31
+ exit 1
32
+ fi
You can’t perform that action at this time.
0 commit comments