Skip to content

Commit 9f22b97

Browse files
committed
[#noissue] Update validate commit workflow
1 parent b6dfca8 commit 9f22b97

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

.github/workflows/validate-commit.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ jobs:
1212
validate-commit-messages:
1313
runs-on: ubuntu-22.04
1414
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
17-
1815
- name: Validate commit messages
16+
env:
17+
COMMIT: ${{ github.event.workflow_run.head_commit.message }}
1918
run: |
2019
# Define the regex for Conventional Commits
2120
commit_regex='^\[#(noissue|[0-9]+?)\].*'
@@ -25,14 +24,9 @@ jobs:
2524
[#1001] Refactor servermap
2625
[#noissue] Update README.md"
2726
28-
# Get the commit messages
29-
commits=$(git log --format=%s origin/main..HEAD)
30-
3127
# 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

0 commit comments

Comments
 (0)