Skip to content

Commit 55f0e37

Browse files
authored
chore(ci): label non-maintainer issues for triage (#1120)
Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
1 parent 8e28209 commit 55f0e37

2 files changed

Lines changed: 12 additions & 50 deletions

File tree

‎.github/workflows/issue-triage.yml‎

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ permissions:
88
issues: write
99

1010
jobs:
11-
label-maintainer-issues:
11+
label-non-maintainer-issues:
1212
runs-on: ubuntu-latest
1313
if: github.repository_owner == 'NVIDIA'
1414
steps:
15-
- name: Check maintainer permissions
16-
id: maintainer
15+
- name: Check contributor permissions
16+
id: contributor
1717
uses: actions/github-script@v7
1818
with:
1919
result-encoding: string
2020
script: |
2121
const author = context.payload.issue.user.login;
22+
const maintainerPermissions = ['admin', 'maintain', 'write'];
2223
2324
try {
2425
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
@@ -27,25 +28,24 @@ jobs:
2728
username: author,
2829
});
2930
30-
if (['admin', 'maintain', 'write'].includes(data.permission)) {
31+
if (maintainerPermissions.includes(data.permission)) {
3132
console.log(`${author} has maintainer permissions: ${data.permission}.`);
32-
return 'true';
33+
return 'false';
3334
}
3435
35-
console.log(`${author} does not have maintainer permissions: ${data.permission}.`);
36+
console.log(`${author} is not a maintainer; permission is ${data.permission}.`);
37+
return 'true';
3638
} catch (e) {
3739
if (e.status === 404) {
38-
console.log(`${author} is not a repository collaborator.`);
39-
return 'false';
40+
console.log(`${author} is not a repository collaborator; labeling for triage.`);
41+
return 'true';
4042
}
4143
4244
throw e;
4345
}
4446
45-
return 'false';
46-
4747
- name: Add triage label
48-
if: steps.maintainer.outputs.result == 'true'
48+
if: steps.contributor.outputs.result == 'true'
4949
uses: actions/github-script@v7
5050
with:
5151
script: |
@@ -55,41 +55,3 @@ jobs:
5555
issue_number: context.issue.number,
5656
labels: ['state:triage-needed'],
5757
});
58-
59-
check-agent-diagnostic:
60-
runs-on: ubuntu-latest
61-
# Only run on bug reports (title starts with "bug:")
62-
if: startsWith(github.event.issue.title, 'bug:')
63-
steps:
64-
- name: Check for agent diagnostic section
65-
uses: actions/github-script@v7
66-
with:
67-
script: |
68-
const body = context.payload.issue.body || '';
69-
70-
// Check if the Agent Diagnostic section has substantive content.
71-
// GitHub issue forms render textarea labels as h3 headings, but
72-
// issues created through gh or API clients often use h2 headings.
73-
const diagnosticMatch = body.match(
74-
/^#{2,4}\s+Agent Diagnostic[s]?\s*\n([\s\S]*?)(?=\n#{2,4}\s+|$)/im
75-
);
76-
77-
const diagnosticText = diagnosticMatch?.[1].trim() || '';
78-
const hasSubstantiveDiagnostic = diagnosticText.length > 0
79-
&& !diagnosticText.toLowerCase().startsWith('example:')
80-
&& !['n/a', 'none', 'no', 'not applicable'].includes(diagnosticText.toLowerCase());
81-
82-
if (hasSubstantiveDiagnostic) {
83-
console.log('Agent diagnostic section found with content. Passing.');
84-
return;
85-
}
86-
87-
console.log('Agent diagnostic section missing or placeholder. Flagging.');
88-
89-
// Add state:triage-needed label
90-
await github.rest.issues.addLabels({
91-
owner: context.repo.owner,
92-
repo: context.repo.repo,
93-
issue_number: context.issue.number,
94-
labels: ['state:triage-needed']
95-
});

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Skills connect into pipelines. Individual skill files don't describe these relat
9292
- **Policy iteration:** `openshell-cli` → `generate-sandbox-policy`
9393

9494
Workflow state labels use the `state:*` prefix, and security work uses `topic:security`. GitHub issue templates assign built-in issue types where applicable, and agent-created issues should use issue types or manual follow-up rather than type labels.
95-
New issues opened by repository collaborators with `write`, `maintain`, or `admin` permission are automatically labeled `state:triage-needed` by the issue triage workflow.
95+
New issues opened by users without `write`, `maintain`, or `admin` repository permission are automatically labeled `state:triage-needed` by the issue triage workflow.
9696

9797
## Prerequisites
9898

0 commit comments

Comments
 (0)