From 1c4fdaf1e97aa99312050894a1cf71936260265c Mon Sep 17 00:00:00 2001 From: Yu-Ting Hsiung Date: Mon, 19 May 2025 20:32:54 +0800 Subject: [PATCH 1/2] docs(label_issues): add logics for adding os related labels --- .github/workflows/label_issues.yml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/label_issues.yml b/.github/workflows/label_issues.yml index 45ca450f89..ec18d98be2 100644 --- a/.github/workflows/label_issues.yml +++ b/.github/workflows/label_issues.yml @@ -15,9 +15,31 @@ jobs: - uses: actions/github-script@v7 with: script: | - github.rest.issues.addLabels({ + const issue = await github.rest.issues.get({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - labels: ['issue-status: needs-triage'] - }) + }); + + const body = issue.data.body || ''; + + const osLabels = new Set(); // Use a Set to avoid duplicates + + 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], + }); From 7fead350fd37926983dc90c96c2f4703bdcd52bc Mon Sep 17 00:00:00 2001 From: Yu-Ting Hsiung Date: Mon, 19 May 2025 21:13:19 +0800 Subject: [PATCH 2/2] docs(label_issues): add comment --- .github/workflows/label_issues.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/label_issues.yml b/.github/workflows/label_issues.yml index ec18d98be2..e74a36c4bd 100644 --- a/.github/workflows/label_issues.yml +++ b/.github/workflows/label_issues.yml @@ -25,6 +25,7 @@ jobs: 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'); }