| 18 | 18 | uses: actions/github-script@v7 |
| 19 | 19 | with: |
| 20 | 20 | script: | |
| 21 | 21 | // GetHard-coded basiclist infoof maintainer usernames |
| 22 | + const maintainers = ['Cohee1207', 'RossAscends', 'Wolfsblvt']; |
| 23 | + |
| 24 | + // Get event details (works for issues and pull requests) |
| 22 | 25 | const { owner, repo } = context.repo; |
| 23 | 26 | const payload = context.payload; |
| 24 | | - // Determine if it's an issue or a pull request |
| 25 | 27 | const eventData = payload.issue || payload.pull_request; |
| 26 | 28 | const username = eventData.user.login; |
| 27 | 29 | const issue_number = eventData.number; |
| 28 | 30 | |
| 29 | | - // Get the collaborator permission level for the user |
| 31 | + if (maintainers.includes(username)) { |
| 30 | | - const { data: permissionData } = await github.repos.getCollaboratorPermissionLevel({ |
| 32 | + console.log(`User ${username} is a maintainer. Adding "Maintainer" label to issue/PR #${issue_number}`); |
| 31 | | - owner, |
| 32 | | - repo, |
| 33 | | - username, |
| 34 | | - }); |
| 35 | | - |
| 36 | | - const permission = permissionData.permission; |
| 37 | | - console.log(`User ${username} has permission level: ${permission}`); |
| 38 | | - |
| 39 | | - // Check if user is an admin or has maintain permissions |
| 40 | | - if (['admin', 'maintain'].includes(permission)) { |
| 41 | | - console.log(`Adding "Maintainer" label to issue/PR #${issue_number}`); |
| 42 | 33 | await github.issues.addLabels({ |
| 43 | 34 | owner, |
| 44 | 35 | repo, |