🔧 update (landing): clarify QuickStart step 3 description #11
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: Commit Lint | |
| on: | |
| pull_request: | |
| branches: [main, dev] | |
| push: | |
| branches: [main, dev] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| lint-commits: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate commit messages | |
| run: | | |
| # Clean Commit convention pattern | |
| # Format: <emoji> <type>[(<scope>)]: <description> | |
| PATTERN='^(📦|🔧|🗑️|🔒|⚙️|☕|🧪|📖|🚀) (new|update|remove|security|setup|chore|test|docs|release)( \([a-z0-9][a-z0-9-]*\))?: .{1,72}$' | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| COMMITS=$(git log --format="%s" "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}") | |
| else | |
| GITHUB_EVENT_BEFORE="${{ github.event.before }}" | |
| GITHUB_EVENT_AFTER="${{ github.event.after }}" | |
| if [ "$GITHUB_EVENT_BEFORE" = "0000000000000000000000000000000000000000" ]; then | |
| # Initial push has no valid "before" SHA, so capture all reachable commits | |
| COMMITS=$(git log --format="%s" "$GITHUB_EVENT_AFTER") | |
| else | |
| COMMITS=$(git log --format="%s" "${GITHUB_EVENT_BEFORE}..${GITHUB_EVENT_AFTER}") | |
| fi | |
| fi | |
| FAILED=0 | |
| while IFS= read -r msg; do | |
| [ -z "$msg" ] && continue | |
| # Allow merge commits | |
| if echo "$msg" | grep -qE "^Merge "; then | |
| continue | |
| fi | |
| if ! echo "$msg" | grep -qP "$PATTERN"; then | |
| echo "✖ Invalid commit message: $msg" | |
| FAILED=1 | |
| else | |
| echo "✔ Valid commit message: $msg" | |
| fi | |
| done <<< "$COMMITS" | |
| if [ "$FAILED" -eq 1 ]; then | |
| echo "" | |
| echo "One or more commit messages do not follow the Clean Commit convention." | |
| echo "Format: <emoji> <type>[(<scope>)]: <description>" | |
| echo "Reference: https://github.com/wgtechlabs/clean-commit" | |
| exit 1 | |
| fi |