File: label_issues.yml

package info (click to toggle)
commitizen 4.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,760 kB
  • sloc: python: 17,069; makefile: 15
file content (46 lines) | stat: -rw-r--r-- 1,269 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Label issues

on:
  issues:
    types:
      - opened
      - reopened

jobs:
  label-issue:
    permissions:
      issues: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/github-script@v8
        with:
          script: |
            const issue = await github.rest.issues.get({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
            });

            const body = issue.data.body || '';

            const osLabels = new Set(); // Use a Set to avoid duplicates

            // Parse the "Environment" section, output of `cz version --report`
            if (body.includes('Operating System: Darwin')) {
              osLabels.add('os: macOS');
            }

            if (body.includes('Operating System: Linux')) {
              osLabels.add('os: Linux');
            }

            if (body.includes('Operating System: Windows')) {
              osLabels.add('os: Windows');
            }

            await github.rest.issues.addLabels({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              labels: ['issue-status: needs-triage', ...osLabels],
            });