File tree Expand file tree Collapse file tree 5 files changed +41
-4
lines changed
Expand file tree Collapse file tree 5 files changed +41
-4
lines changed Original file line number Diff line number Diff line change 33name : " Bug report"
44description : " Create a bug report to help us improve."
55title : " [Bug]: <title>"
6- labels : ["triage "]
6+ labels : ["bug "]
77type : " Bug"
88assignees :
99 - simonkurtz-MSFT
Original file line number Diff line number Diff line change 33name : " Sample Scenario"
44description : " Suggest a new API Management Sample Scenario."
55title : " [Scenario]: <title>"
6- labels : ["triage", " scenario"]
6+ labels : ["scenario"]
77type : " Feature"
88assignees :
99 - simonkurtz-MSFT
Original file line number Diff line number Diff line change 33name : " Feature Request"
44description : " Suggest a new feature or improvement."
55title : " [Feature]: <title>"
6- labels : ["triage"]
76type : " Feature"
87assignees :
98 - simonkurtz-MSFT
Original file line number Diff line number Diff line change 33name : " Task"
44description : " Create a general task that does not fit other categories."
55title : " [Task]: <title>"
6- labels : ["triage"]
76type : " Task"
87assignees :
98 - simonkurtz-MSFT
Original file line number Diff line number Diff line change 1+
2+ name : Label Non-Admin Issues
3+
4+ on :
5+ issues :
6+ types : [opened]
7+
8+ jobs :
9+ label-if-not-admin :
10+ runs-on : ubuntu-latest
11+ steps :
12+ # Step 1: Check if the issue creator has admin access to the repository
13+ - name : Check if issue creator has admin access to the repo
14+ id : check_permission
15+ uses : actions/github-script@v7
16+ with :
17+ script : |
18+ const username = context.payload.issue.user.login;
19+ const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
20+ owner: context.repo.owner,
21+ repo: context.repo.repo,
22+ username
23+ });
24+
25+ console.log(`User ${username} has permission: ${permission.permission}`);
26+ core.setOutput("is_admin", permission.permission === "admin");
27+
28+ # Step 2: Add 'triage' label if the issue creator is not an admin
29+ - name : Add triage label if not admin
30+ if : steps.check_permission.outputs.is_admin != 'true'
31+ uses : actions/github-script@v7
32+ with :
33+ script : |
34+ await github.rest.issues.addLabels({
35+ owner: context.repo.owner,
36+ repo: context.repo.repo,
37+ issue_number: context.issue.number,
38+ labels: ['triage']
39+ });
You can’t perform that action at this time.
0 commit comments