Skip to content

Commit e9c4217

Browse files
Refine issue labels and setting triage for non-admin
1 parent 75ea2a8 commit e9c4217

File tree

5 files changed

+41
-4
lines changed

5 files changed

+41
-4
lines changed

.github/ISSUE_TEMPLATE/1-bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name: "Bug report"
44
description: "Create a bug report to help us improve."
55
title: "[Bug]: <title>"
6-
labels: ["triage"]
6+
labels: ["bug"]
77
type: "Bug"
88
assignees:
99
- simonkurtz-MSFT

.github/ISSUE_TEMPLATE/2-sample_scenario.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name: "Sample Scenario"
44
description: "Suggest a new API Management Sample Scenario."
55
title: "[Scenario]: <title>"
6-
labels: ["triage", "scenario"]
6+
labels: ["scenario"]
77
type: "Feature"
88
assignees:
99
- simonkurtz-MSFT

.github/ISSUE_TEMPLATE/3-feature_request.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
name: "Feature Request"
44
description: "Suggest a new feature or improvement."
55
title: "[Feature]: <title>"
6-
labels: ["triage"]
76
type: "Feature"
87
assignees:
98
- simonkurtz-MSFT

.github/ISSUE_TEMPLATE/9-task.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
name: "Task"
44
description: "Create a general task that does not fit other categories."
55
title: "[Task]: <title>"
6-
labels: ["triage"]
76
type: "Task"
87
assignees:
98
- simonkurtz-MSFT
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
});

0 commit comments

Comments
 (0)