From a34765bd3bfc2fccf44ecd808de8e535ec7c7fe5 Mon Sep 17 00:00:00 2001 From: Roulleau Date: Thu, 30 Apr 2026 17:33:24 +0200 Subject: [PATCH 1/3] test bot --- front/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/front/README.md b/front/README.md index ddf636c..b1a204e 100644 --- a/front/README.md +++ b/front/README.md @@ -34,3 +34,5 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac ## Further help To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). + +## This is a small test for the label bot From ea4dc91b42d086c6b50ad66ba338d0764a28b947 Mon Sep 17 00:00:00 2001 From: Tom <72670578+TRoulleau@users.noreply.github.com> Date: Thu, 30 Apr 2026 17:49:46 +0200 Subject: [PATCH 2/3] Refactor auto-label workflow for PRs Updated the auto-label workflow to use the latest GitHub Script action and modern syntax for listing pull request files. --- .github/workflows/auto-label.yml | 45 ++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index 6345941..0e97fef 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -1,35 +1,48 @@ name: Auto Label PRs + on: pull_request: types: [opened, synchronize, reopened] + +permissions: + pull-requests: write + issues: write + jobs: labeler: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Auto label PR - uses: actions/github-script@v4 + steps: + - name: Label PR based on files + uses: actions/github-script@v7 with: script: | - const pr = context.payload.pull_request; - const files = await github.paginate(github.rest.pulls.listFiles.endpoint.merge({ + # 3. Ajout de ".rest" pour la syntaxe moderne + const files = await github.rest.pulls.listFiles({ owner: context.repo.owner, repo: context.repo.repo, - pull_number: pr.number - })); - // On détermine les labels à appliquer en fonction des fichiers modifiés + pull_number: context.issue.number, + }); + const labels = new Set(); - files.forEach(file => { - if (file.filename.startsWith('front/')) labels.add('frontend'); - if (file.filename.startsWith('api/')) labels.add('backend'); - if (file.filename.endsWith('.md')) labels.add('documentation'); + + files.data.forEach(file => { + if (file.filename.startsWith("front/")) { + labels.add("frontend"); + } + if (file.filename.startsWith("api/")) { + labels.add("api"); + } + if (file.filename.endsWith(".md")) { + labels.add("documentation"); + } }); + if (labels.size > 0) { + # 3. Ajout de ".rest" ici aussi await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: pr.number, - labels: Array.from(labels) + issue_number: context.issue.number, + labels: [...labels], }); } From 918aa2c097ee4813c3693061eeb49630b0961885 Mon Sep 17 00:00:00 2001 From: Tom <72670578+TRoulleau@users.noreply.github.com> Date: Thu, 30 Apr 2026 17:51:14 +0200 Subject: [PATCH 3/3] Clean up comments in auto-label workflow Removed comments about adding '.rest' for modern syntax. --- .github/workflows/auto-label.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index 0e97fef..b90dbcc 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -16,7 +16,6 @@ jobs: uses: actions/github-script@v7 with: script: | - # 3. Ajout de ".rest" pour la syntaxe moderne const files = await github.rest.pulls.listFiles({ owner: context.repo.owner, repo: context.repo.repo, @@ -38,7 +37,6 @@ jobs: }); if (labels.size > 0) { - # 3. Ajout de ".rest" ici aussi await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo,