-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (30 loc) · 1.18 KB
/
Copy pathlabels.yml
File metadata and controls
34 lines (30 loc) · 1.18 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
name: Ajout automatique de labels
on:
pull_request:
types: [opened]
jobs:
auto-labels:
runs-on: ubuntu-latest
steps:
- name: Ajouter les labels selon le type de branche
uses: actions/github-script@v7
with:
script: |
const branch = context.payload.pull_request.head.ref;
const prNumber = context.payload.pull_request.number;
const labels = [];
// Définition des labels selon le type de branche
if (branch.startsWith('feature/') || branch.startsWith('feat/')) labels.push('feature');
if (branch.startsWith('fix/')) labels.push('bug');
if (branch.startsWith('hotfix/')) labels.push('hotfix');
if (branch.startsWith('release/')) labels.push('release');
if (labels.length > 0) {
await github.rest.issues.addLabels({
...context.repo,
issue_number: prNumber,
labels
});
console.log(`✅ Labels ajoutés : ${labels.join(', ')}`);
} else {
console.log(`⚠️ Aucun label ajouté. Vérifiez le nom de branche : ${branch}`);
}