Switch to action to label maintainers, duh

95e60b0f7944978af6abda25e850bd3d3f8ed223

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +8 -28Showing whitespace changes
.github/workflows/on-open-handler.yml+8 -28
@@ -10,35 +10,15 @@ jobs:
1010 label-maintainer:
1111 name: Label if Author is a Repo Maintainer
1212 runs-on: ubuntu-latest
13+ if: contains(fromJson('["Cohee1207", "RossAscends", "Wolfsblvt"]'), github.actor)
1314
1415 steps:
1516 - name: Label if Author is a Repo Maintainer
1617 # GitHub🤖 ScriptIssues Helper
1718 # https://github.com/marketplace/actions/githubissues-scripthelper
1819 uses: actions-cool/githubissues-scripthelper@v7v3
1920 with:
20- script: |
21+ actions: 'add-labels'
21- const github = require('@actions/github');
22+ token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
22- const core = require('@actions/core');
23+ issue-number: ${{ github.event.issue.number || github.event.pull_request.number }}
23-
24+ labels: '👷 Maintainer'
24- // Hard-coded list of maintainer usernames
25- const maintainers = ['Cohee1207', 'RossAscends', 'Wolfsblvt'];
26-
27- // Get event details (works for issues and pull requests)
28- const { owner, repo } = github.context.repo;
29- const payload = github.context.payload;
30- const eventData = payload.issue || payload.pull_request;
31- const username = eventData.user.login;
32- const issue_number = eventData.number;
33-
34- if (maintainers.includes(username)) {
35- core.info(`User ${username} is a maintainer. Adding "Maintainer" label to issue/PR #${issue_number}`);
36- await github.rest.issues.addLabels({
37- owner,
38- repo,
39- issue_number,
40- labels: ['👷 Maintainer'],
41- });
42- } else {
43- core.info(`User ${username} is not on the maintainer list.`);
44- }