mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-18 05:39:50 +08:00
48 lines
1.6 KiB
YAML
48 lines
1.6 KiB
YAML
name: Issue Triage Gate
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
|
|
permissions:
|
|
issues: write
|
|
|
|
jobs:
|
|
check-agent-diagnostic:
|
|
runs-on: ubuntu-latest
|
|
# Only run on bug reports (title starts with "bug:")
|
|
if: startsWith(github.event.issue.title, 'bug:')
|
|
steps:
|
|
- name: Check for agent diagnostic section
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const body = context.payload.issue.body || '';
|
|
|
|
// Check if the Agent Diagnostic section has substantive content.
|
|
// GitHub issue forms render textarea labels as h3 headings, but
|
|
// issues created through gh or API clients often use h2 headings.
|
|
const diagnosticMatch = body.match(
|
|
/^#{2,4}\s+Agent Diagnostic[s]?\s*\n([\s\S]*?)(?=\n#{2,4}\s+|$)/im
|
|
);
|
|
|
|
const diagnosticText = diagnosticMatch?.[1].trim() || '';
|
|
const hasSubstantiveDiagnostic = diagnosticText.length > 0
|
|
&& !diagnosticText.toLowerCase().startsWith('example:')
|
|
&& !['n/a', 'none', 'no', 'not applicable'].includes(diagnosticText.toLowerCase());
|
|
|
|
if (hasSubstantiveDiagnostic) {
|
|
console.log('Agent diagnostic section found with content. Passing.');
|
|
return;
|
|
}
|
|
|
|
console.log('Agent diagnostic section missing or placeholder. Flagging.');
|
|
|
|
// Add state:triage-needed label
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.issue.number,
|
|
labels: ['state:triage-needed']
|
|
});
|