feat(security): add robust Anti-VPN checker with optional Redis support #29
This file contains hidden or 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
| name: Validate Commit Messages | ||
|
Check failure on line 1 in .github/workflows/commit-message-check.yml
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| check-commit-messages: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
| - name: Check commit messages | ||
| run: | | ||
| echo "Checking commit messages on main branch..." | ||
| commits=$(git log -n ${{ github.event.commits | length }} --pretty=format:%s) | ||
| pattern='^(feat|fix|chore|docs|style|refactor|perf|test|build)(\(.+\))?: .+' | ||
| invalid=0 | ||
| while IFS= read -r line; do | ||
| if ! [[ "$line" =~ $pattern ]]; then | ||
| echo "❌ Invalid commit message: $line" | ||
| invalid=1 | ||
| fi | ||
| done <<< "$commits" | ||
| if [ $invalid -eq 1 ]; then | ||
| echo "::error::Some commit messages do not follow the conventional commit format." | ||
| exit 1 | ||
| else | ||
| echo "✅ All commit messages are valid." | ||
| fi | ||