Skip to content

Commit

Permalink
Merge branch 'chaerishme' of https://github.com/chaerishme/python-rac…
Browse files Browse the repository at this point in the history
…ingcar into chaerishme
  • Loading branch information
chaerishme committed Feb 13, 2025
2 parents bbe7a9b + d062b8e commit 15bd76b
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/check-commit-convention.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check Commit Message Convention

on: pull_request

jobs:
check-commit-message:
runs-on: ubuntu-latest
steps:
- name: Checkout code with full history
uses: actions/checkout@v4
with:
fetch-depth: 0 # 전체 Git 히스토리를 가져옴

- name: Get base branch
run: echo "BASE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV

- name: Get all new commit messages in PR
run: |
commit_messages=$(git log --format=%s origin/$BASE_BRANCH..HEAD)
echo "Commit Messages in PR:"
echo "$commit_messages"
echo "COMMIT_MESSAGES<<EOF" >> $GITHUB_ENV
echo "$commit_messages" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Validate commit messages
run: |
invalid_commits=0
echo "🔍 Checking commit message convention..."
while IFS= read -r commit_message; do
# "Merge"로 시작하는 메시지는 검사에서 제외
if [[ "$commit_message" =~ ^Merge ]]; then
echo "⚡ Skipping merge commit: $commit_message"
continue
fi
# Commit message validation
if [[ ! "$commit_message" =~ ^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?!?:\ .+ ]]; then
echo "❌ Invalid commit message: $commit_message"
invalid_commits=$((invalid_commits + 1))
else
echo "✅ Valid commit message: $commit_message"
fi
done <<< "$COMMIT_MESSAGES"
if [[ $invalid_commits -gt 0 ]]; then
echo "🚨 Some commit messages do not follow the convention!"
echo "Example: 'feat: add login API'"
exit 1
fi
echo "🎉 All commit messages follow the convention!"
3 changes: 3 additions & 0 deletions .github/workflows/check-indent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
run: |
echo "[FORMAT]" > .pylintrc
echo "max-nested-blocks=2" >> .pylintrc
echo "[MESSAGES CONTROL]" >> .pylintrc
echo "disable=all" >> .pylintrc
echo "enable=format" >> .pylintrc
- name: Run pylint
run: pylint --rcfile=.pylintrc src/

0 comments on commit 15bd76b

Please sign in to comment.