Debian Codegraph @

.github/workflows/label_issues.yml

raw
1 name: Label issues
2
3 on:
4 issues:
5 types:
6 - opened
7 - reopened
8
9 jobs:
10 label-issue:
11 permissions:
12 issues: write
13 runs-on: ubuntu-latest
14 steps:
15 - uses: actions/github-script@v9
16 with:
17 script: |
18 const issue = await github.rest.issues.get({
19 issue_number: context.issue.number,
20 owner: context.repo.owner,
21 repo: context.repo.repo,
22 });
23
24 const body = issue.data.body || '';
25
26 const osLabels = new Set(); // Use a Set to avoid duplicates
27
28 // Parse the "Environment" section, output of `cz version --report`
29 if (body.includes('Operating System: Darwin')) {
30 osLabels.add('os: macOS');
31 }
32
33 if (body.includes('Operating System: Linux')) {
34 osLabels.add('os: Linux');
35 }
36
37 if (body.includes('Operating System: Windows')) {
38 osLabels.add('os: Windows');
39 }
40
41 await github.rest.issues.addLabels({
42 issue_number: context.issue.number,
43 owner: context.repo.owner,
44 repo: context.repo.repo,
45 labels: ['issue-status: needs-triage', ...osLabels],
46 });