fix(deploy): fixes #151 - scraping web #121
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: 'Vérification des messages de commit' | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize] | |
| jobs: | |
| commit-message-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 'Checkout' | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: 'Valider les messages de commit' | |
| run: | | |
| echo "🔍 Vérification des messages de commit pour la PR" | |
| BASE_REF="${{ github.event.pull_request.base.ref }}" | |
| echo "Branche de base : $BASE_REF" | |
| git fetch origin $BASE_REF | |
| # Commits avec numéro d'issue (feat, fix, hotfix, refactor, test) | |
| REGEX_ISSUE="^(feat|fix|hotfix|refactor|test)\([a-z0-9_-]+\): [Ff]ixes #[0-9]+ - .+" | |
| # Commits sans numéro d'issue autorisés (chore, docs, ci, fix(ci)) | |
| REGEX_NO_ISSUE="^(chore|docs|ci|fix)\(ci\): .+|^(chore|docs)\([a-z0-9_-]+\): .+" | |
| COMMITS=$(git log origin/$BASE_REF..HEAD --pretty=format:"%H") | |
| INVALID=false | |
| for COMMIT in $COMMITS; do | |
| MESSAGE=$(git log -1 --pretty=format:"%s" $COMMIT | sed 's/^[[:space:]]*//') | |
| # Ignorer tous les commits de merge | |
| if [[ "$MESSAGE" =~ ^Merge ]]; then | |
| echo "⏭️ Commit de merge ignoré: $MESSAGE" | |
| continue | |
| fi | |
| if [[ "$MESSAGE" =~ $REGEX_ISSUE ]] || [[ "$MESSAGE" =~ $REGEX_NO_ISSUE ]]; then | |
| echo "✅ Commit valide: $MESSAGE" | |
| else | |
| echo "❌ Commit invalide: $MESSAGE" | |
| INVALID=true | |
| fi | |
| done | |
| if [ "$INVALID" = true ]; then | |
| echo "" | |
| echo "⚠️ Un ou plusieurs commits ne respectent pas le format attendu !" | |
| echo "Format attendu : type(nom): Fixes #<issue> - message" | |
| echo "Types autorisés : feat, fix, docs, chore, refactor, test, hotfix" | |
| exit 1 | |
| fi |