-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.37 KB
/
Copy pathcheck-branch-name.yml
File metadata and controls
44 lines (37 loc) · 1.37 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 branch name
on:
pull_request:
jobs:
check-branch-name:
runs-on: ubuntu-latest
steps:
- name: Validate branch name
run: |
BRANCH_NAME="${GITHUB_HEAD_REF}"
echo "🔎 Vérification du nom de la branche"
echo "➡️ Branche détectée : $BRANCH_NAME"
echo ""
REGEX="^(main|dev|feat\/.+|feature\/.+|fix\/.+|hotfix\/.+)$"
if [[ ! "$BRANCH_NAME" =~ $REGEX ]]; then
echo "❌ Nom de branche invalide"
echo ""
echo "👉 Branche détectée : $BRANCH_NAME"
echo ""
echo "📌 Conventions de nommage attendues :"
echo " - main"
echo " - dev"
echo " - feat/ma-feature ou feature/ma-feature"
echo " - fix/mon-correctif"
echo " - hotfix/incident-production"
echo ""
echo "🛠️ Action attendue :"
echo " - renomme ta branche localement"
echo " - puis pousse-la à nouveau avant de créer la PR"
echo ""
echo "ℹ️ Exemple :"
echo " git branch -m ancienne-branche feat/ma-feature"
echo " git push origin feat/ma-feature"
exit 1
fi
echo "✅ Nom de branche conforme aux conventions"
echo "🚀 Tu peux continuer avec la Pull Request"