From 95e60b0f7944978af6abda25e850bd3d3f8ed223 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Fri, 14 Mar 2025 00:24:11 +0100 Subject: [PATCH] Switch to action to label maintainers, duh --- .github/workflows/on-open-handler.yml | 36 ++++++--------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/.github/workflows/on-open-handler.yml b/.github/workflows/on-open-handler.yml index 2370184e3..009a9efc2 100644 --- a/.github/workflows/on-open-handler.yml +++ b/.github/workflows/on-open-handler.yml @@ -10,35 +10,15 @@ jobs: label-maintainer: name: Label if Author is a Repo Maintainer runs-on: ubuntu-latest + if: contains(fromJson('["Cohee1207", "RossAscends", "Wolfsblvt"]'), github.actor) steps: - name: Label if Author is a Repo Maintainer - # GitHub Script - # https://github.com/marketplace/actions/github-script - uses: actions/github-script@v7 + # 🤖 Issues Helper + # https://github.com/marketplace/actions/issues-helper + uses: actions-cool/issues-helper@v3 with: - script: | - const github = require('@actions/github'); - const core = require('@actions/core'); - - // Hard-coded list of maintainer usernames - const maintainers = ['Cohee1207', 'RossAscends', 'Wolfsblvt']; - - // Get event details (works for issues and pull requests) - const { owner, repo } = github.context.repo; - const payload = github.context.payload; - const eventData = payload.issue || payload.pull_request; - const username = eventData.user.login; - const issue_number = eventData.number; - - if (maintainers.includes(username)) { - core.info(`User ${username} is a maintainer. Adding "Maintainer" label to issue/PR #${issue_number}`); - await github.rest.issues.addLabels({ - owner, - repo, - issue_number, - labels: ['👷 Maintainer'], - }); - } else { - core.info(`User ${username} is not on the maintainer list.`); - } + actions: 'add-labels' + token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.issue.number || github.event.pull_request.number }} + labels: '👷 Maintainer'