-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(workflows): add usage docs in readme and update commit norm checker
- Loading branch information
1 parent
94c026c
commit 004222a
Showing
2 changed files
with
47 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
name: Commit Name Checker | ||
name: Commit Norm Checker | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
verify-commit-name: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up Git repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Commit Name Checker | ||
- name: Commit Norm Checker | ||
run: | | ||
commit_msg=$(git log --format=%B -n 1 ${{ github.sha }}) | ||
keyword_regex="^\[[A-Z][@_A-Za-z, ]+\] : " | ||
commit_msg=$(git log --format=%B -n 1 ${{ github.sha }}) | ||
keyword_regex="^([a-z]+\([0-9A-Za-z_.-]+\)|^[a-z]+): " | ||
if [[ ! $commit_msg =~ $keyword_regex ]]; then | ||
if [[ $commit_msg =~ ^Merge\ .* ]]; then | ||
echo "Skipping merge commit" | ||
else | ||
echo $commit_msg | ||
echo "Commit message does not match expected format. Please use the following format:\"[Keyword] : comment\"" | ||
exit 1 | ||
fi | ||
if [[ ! $commit_msg =~ $keyword_regex ]]; then | ||
if [[ $commit_msg =~ ^Merge\ .* ]]; then | ||
echo "Skipping merge commit" | ||
else | ||
echo $commit_msg | ||
echo "Commit message does not match expected format. Please use the following format: \"keyword(scope): comment\"" | ||
exit 1 | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters