-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (36 loc) · 1.35 KB
/
Copy pathcheck-commit-message.yml
File metadata and controls
44 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Check PR title
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
check-pr-title:
runs-on: ubuntu-latest
steps:
- name: Validate PR title
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
echo "🔎 Vérification du titre de la Pull Request"
echo "------------------------------------------"
echo "$PR_TITLE"
echo ""
REGEX="^(feat|fix|hotfix|docs|refactor|test|chore)(\([a-zA-Z0-9_-]+\))?: .+"
if [[ ! "$PR_TITLE" =~ $REGEX ]]; then
echo "❌ Titre de PR non conforme"
echo ""
echo "👉 Format attendu :"
echo " type(scope): description courte"
echo ""
echo "👉 Types autorisés : feat, fix, hotfix, docs, refactor, test, chore"
echo ""
echo "📌 Exemples valides :"
echo " docs(database): ajout du dictionnaire"
echo " fix(auth): correction login"
exit 1
fi
if ! echo "$PR_TITLE" | grep -qiE "(fix|fixes|closes|resolves) #[0-9]+"; then
echo "⚠️ Aucun lien avec une issue détecté"
echo ""
echo "👉 Bonne pratique recommandée :"
echo " ajoute dans le titre : Fixes #<numéro>"
fi
echo "✅ Titre de PR conforme"