diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 0137985e4ac..9252d2394ae 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,11 +1,29 @@ +# THIS IS A BUBBER WORKFLOW FILE name: PR Labeling on: - - pull_request_target + pull_request_target: + types: [closed, opened, synchronize] jobs: + # labeler must run before gbp because gbp calculates itself based on labels labeler: + runs-on: ubuntu-24.04 + if: github.event.action == 'opened' || github.event.action == 'synchronize' permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest + pull-requests: write # to apply labels + issues: write # to apply labels steps: - - uses: actions/labeler@v5 + - name: Checkout + uses: actions/checkout@v6 + - name: Run Auto Labeler + uses: actions/github-script@v9 + with: + script: | + const { get_updated_label_set } = await import('${{ github.workspace }}/tools/pull_request_hooks/autoLabel.js'); + const new_labels = await get_updated_label_set({ github, context }); + github.rest.issues.setLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: new_labels, + }); + console.log(`Labels updated: ${new_labels}`); diff --git a/tools/pull_request_hooks/autoLabelConfig.js b/tools/pull_request_hooks/autoLabelConfig.js index 6d848fa715c..b2ae43e5143 100644 --- a/tools/pull_request_hooks/autoLabelConfig.js +++ b/tools/pull_request_hooks/autoLabelConfig.js @@ -78,7 +78,7 @@ export const changelog_labels = { default_text: "fixed a few things", keywords: ["fix", "fixes", "bugfix"], }, - "Quality of Life": { + "QoL": { default_text: "made something easier to use", keywords: ["qol"], },