From ea989df6a1793b947a6469a67ac6ae4b762b11d3 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Thu, 13 Mar 2025 23:08:29 +0100 Subject: [PATCH] Hard-code maintainer list for maintainer label --- .github/workflows/on-open-handler.yml | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/.github/workflows/on-open-handler.yml b/.github/workflows/on-open-handler.yml index 07e781475..b13c0d801 100644 --- a/.github/workflows/on-open-handler.yml +++ b/.github/workflows/on-open-handler.yml @@ -18,27 +18,18 @@ jobs: uses: actions/github-script@v7 with: script: | - // Get basic info + // Hard-coded list of maintainer usernames + const maintainers = ['Cohee1207', 'RossAscends', 'Wolfsblvt']; + + // Get event details (works for issues and pull requests) const { owner, repo } = context.repo; const payload = context.payload; - // Determine if it's an issue or a pull request const eventData = payload.issue || payload.pull_request; const username = eventData.user.login; const issue_number = eventData.number; - // Get the collaborator permission level for the user - const { data: permissionData } = await github.repos.getCollaboratorPermissionLevel({ - owner, - repo, - username, - }); - - const permission = permissionData.permission; - console.log(`User ${username} has permission level: ${permission}`); - - // Check if user is an admin or has maintain permissions - if (['admin', 'maintain'].includes(permission)) { - console.log(`Adding "Maintainer" label to issue/PR #${issue_number}`); + if (maintainers.includes(username)) { + console.log(`User ${username} is a maintainer. Adding "Maintainer" label to issue/PR #${issue_number}`); await github.issues.addLabels({ owner, repo, @@ -46,5 +37,5 @@ jobs: labels: ['👷 Maintainer'], }); } else { - console.log(`User ${username} is not a repo maintainer.`); + console.log(`User ${username} is not on the maintainer list.`); }