feat(workflow): Fixes #2 - Ajout github actions pour workflow #1
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: 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}`); | |
| } |