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:
10 label-maintainer:10 label-maintainer:
11 name: Label if Author is a Repo Maintainer11 name: Label if Author is a Repo Maintainer
12 runs-on: ubuntu-latest12 runs-on: ubuntu-latest
13 if: contains(fromJson('["Cohee1207", "RossAscends", "Wolfsblvt"]'), github.actor)
1314
14 steps:15 steps:
15 - name: Label if Author is a Repo Maintainer16 - name: Label if Author is a Repo Maintainer
16 # GitHub Script17 # 🤖 Issues Helper
17 # https://github.com/marketplace/actions/github-script18 # https://github.com/marketplace/actions/issues-helper
18 uses: actions/github-script@v719 uses: actions-cool/issues-helper@v3
19 with:20 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 }}
2324 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 }