Compare commits

..

1 commit

Author SHA1 Message Date
ZoopaMario ba9b69350e Add workflows verifying bash and commit messages
Some checks failed
Check Commit Messages / check-commit-message (pull_request) Failing after 16s
This PR adds the first two workflows:
1. Bash linter
2. Commit message verification
2024-12-29 04:58:07 +01:00

View file

@ -22,7 +22,7 @@ jobs:
run: |
echo "Checking if the subject starts correctly..."
commit_message=$(git log -1 --pretty=%B)
if ! [[ "$commit_message" =~ ^([A-Z]|\S+:|git\ subrepo\ (clone|pull)) ]]; then
if ! echo "$commit_message" | grep -Eq "^([A-Z]|\S+:|git subrepo (clone|pull))"; then
echo "Error: The subject does not start with a capital letter, a tag, or a valid 'git subrepo' command."
exit 1
fi
@ -32,7 +32,7 @@ jobs:
run: |
echo "Checking commit message type and format..."
commit_message=$(git log -1 --pretty=%B)
if ! [[ "$commit_message" =~ ^(feat|fix|chore|docs|style|refactor|test|perf): ]]; then
if ! echo "$commit_message" | grep -Eq "^(feat|fix|chore|docs|style|refactor|test|perf):"; then
echo "Error: Commit message does not follow the required format: <type>: <subject>"
exit 1
fi
@ -42,7 +42,7 @@ jobs:
run: |
echo "Checking subject length..."
commit_subject=$(git log -1 --pretty=%B | head -n 1)
if [[ ${#commit_subject} -gt 72 ]]; then
if [ ${#commit_subject} -gt 72 ]; then
echo "Error: Commit message subject exceeds 72 characters."
exit 1
fi
@ -52,7 +52,7 @@ jobs:
run: |
echo "Checking subject ending..."
commit_subject=$(git log -1 --pretty=%B | head -n 1)
if [[ "$commit_subject" =~ \.$ ]]; then
if echo "$commit_subject" | grep -q "\.$"; then
echo "Error: Commit message subject should not end with a dot."
exit 1
fi
@ -62,7 +62,7 @@ jobs:
run: |
echo "Checking for an empty line after the title..."
commit_body=$(git log -1 --pretty=%B | tail -n +2)
if [[ -n "$commit_body" && ! "$commit_body" =~ ^$ ]]; then
if [ -n "$commit_body" ] && ! echo "$commit_body" | grep -q "^$"; then
echo "Error: There must be an empty line between the title and description."
exit 1
fi