1. Update bug/feature report template to add component selection. (#2485)

2. Add workflow to apply component label automatically
This commit is contained in:
Larry Wu
2025-07-23 00:38:03 +08:00
committed by GitHub
parent e51efbfe18
commit 6c0c8b7484
5 changed files with 120 additions and 43 deletions

47
.github/workflows/auto-label-issues.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: Auto Label Issues
on:
issues:
types: [opened]
jobs:
add-labels:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Add component label
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const body = issue.body || '';
// Parse the issue body to find the component selection
// GitHub renders dropdown selections as "### Which component has the problem?\n\n{selection}"
const componentMatch = body.match(/### Which component has the problem\?\s*\n\s*\n\s*(.+?)(?:\n|$)/);
if (componentMatch) {
const component = componentMatch[1].trim();
let label = '';
// Map component selections to labels
switch(component) {
case 'CuTe DSL':
label = 'CuTe DSL';
break;
case 'CUTLASS C++':
label = 'CUTLASS C++';
break;
}
if (label) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: [label]
});
console.log(`Added label: ${label}`);
}
}