Co-authored-by: Cyprien <courtot.c@gmail.com> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Laure Hugo <201583486+laure0303@users.noreply.github.com> Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Peter Evers <peter.evers@mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Yousria <yousria.debaud@mistral.ai> Co-authored-by: renovate-mistral[bot] <253709520+renovate-mistral[bot]@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
64 lines
2.5 KiB
YAML
64 lines
2.5 KiB
YAML
name: Issue Labeler
|
|
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
|
|
jobs:
|
|
label-component:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
|
|
- name: Parse bug report form
|
|
id: parse-bug
|
|
uses: stefanbuck/github-issue-parser@cb6e97157cbf851e3a393ff8d57c93a484cc323f # v3.2.5
|
|
with:
|
|
template-path: .github/ISSUE_TEMPLATE/bug-report.yml
|
|
continue-on-error: true
|
|
|
|
- name: Parse feature request form
|
|
id: parse-feature
|
|
uses: stefanbuck/github-issue-parser@cb6e97157cbf851e3a393ff8d57c93a484cc323f # v3.2.5
|
|
with:
|
|
template-path: .github/ISSUE_TEMPLATE/feature-request.yml
|
|
continue-on-error: true
|
|
|
|
- name: Apply component label
|
|
uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9.0.0
|
|
env:
|
|
BUG_COMPONENT: ${{ steps.parse-bug.outputs.issueparser_component }}
|
|
FEATURE_COMPONENT: ${{ steps.parse-feature.outputs.issueparser_component }}
|
|
with:
|
|
script: |
|
|
const bugComponent = process.env.BUG_COMPONENT;
|
|
const featureComponent = process.env.FEATURE_COMPONENT;
|
|
const component = bugComponent || featureComponent;
|
|
|
|
if (!component) {
|
|
console.log('No component field found, skipping labeling');
|
|
return;
|
|
}
|
|
|
|
const componentLabels = new Map([
|
|
['CLI', 'CLI'],
|
|
['ACP', 'ACP'],
|
|
['VS Code extension', 'VS Code extension'],
|
|
]);
|
|
const label = componentLabels.get(component);
|
|
|
|
if (!label) {
|
|
console.log(`Unknown component '${component}', skipping labeling`);
|
|
return;
|
|
}
|
|
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.issue.number,
|
|
labels: [label],
|
|
});
|
|
console.log(`Added label: ${label}`);
|