Skip to content

Visual Studio Code, rebuilt in Rust

Rust

ci(issues): label issues by the platform picked in the form (#95)

Artur Rok99044c9b382f
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 01276c4151b..149f539fe87 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -52,6 +52,18 @@ body:
label: Other application version (optional)
description: Complete this only when you selected "Other / not listed".
placeholder: 1.148.0-insider
+ - type: dropdown
+ id: platform
+ attributes:
+ label: Platform
+ description: Pick every platform this affects.
+ multiple: true
+ options:
+ - macOS
+ - Windows
+ - Linux
+ validations:
+ required: true
- type: input
id: os_version
attributes:
diff --git a/.github/ISSUE_TEMPLATE/new_feature.yml b/.github/ISSUE_TEMPLATE/new_feature.yml
index ab8aa022c45..9a30fc30f57 100644
--- a/.github/ISSUE_TEMPLATE/new_feature.yml
+++ b/.github/ISSUE_TEMPLATE/new_feature.yml
@@ -25,6 +25,18 @@ body:
attributes:
label: Proposed solution / behaviour
placeholder: Describe how it should work (interaction, defaults, edge cases)
+ - type: dropdown
+ id: platform
+ attributes:
+ label: Platform
+ description: Pick every platform this affects.
+ multiple: true
+ options:
+ - macOS
+ - Windows
+ - Linux
+ validations:
+ required: false
- type: input
id: related_issues
attributes:
diff --git a/.github/workflows/issue-platform-labels.yml b/.github/workflows/issue-platform-labels.yml
new file mode 100644
index 00000000000..e1089cdfdae
--- /dev/null
+++ b/.github/workflows/issue-platform-labels.yml
@@ -0,0 +1,43 @@
+name: issue-platform-labels
+
+on:
+ issues:
+ types: [opened, edited]
+
+permissions:
+ issues: write
+
+jobs:
+ label:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Sync platform:* labels with the Platform field
+ env:
+ GH_TOKEN: ${{ github.token }}
+ NUMBER: ${{ github.event.issue.number }}
+ BODY: ${{ github.event.issue.body }}
+ LABELS: ${{ toJSON(github.event.issue.labels.*.name) }}
+ run: |
+ python3 - <<'PY' > "${RUNNER_TEMP}/args"
+ import json
+ import os
+
+ platforms = {"macOS": "platform:macos", "Windows": "platform:windows", "Linux": "platform:linux"}
+ # Issue forms render a multi-select as "### Platform\n\nmacOS, Linux".
+ _, found, rest = (os.environ["BODY"] or "").partition("### Platform\n")
+ # Issues not opened from a form keep labels set by hand.
+ if not found:
+ raise SystemExit(0)
+ selected = rest.split("###")[0].strip().split(", ")
+ wanted = {platforms[name] for name in selected if name in platforms}
+ # docs/agents/triage-labels.md: an issue on every platform gets no platform label.
+ if len(wanted) == len(platforms):
+ wanted = set()
+ current = {label for label in json.loads(os.environ["LABELS"]) if label.startswith("platform:")}
+ args = [f"--add-label={label}" for label in sorted(wanted - current)]
+ args += [f"--remove-label={label}" for label in sorted(current - wanted)]
+ print("\n".join(args))
+ PY
+ mapfile -t args < "${RUNNER_TEMP}/args"
+ if [ -z "${args[*]}" ]; then exit 0; fi
+ gh issue edit "$NUMBER" -R "$GITHUB_REPOSITORY" "${args[@]}"
diff --git a/docs/agents/triage-labels.md b/docs/agents/triage-labels.md
index 9ba65aab337..38c3aa89f1f 100644
--- a/docs/agents/triage-labels.md
+++ b/docs/agents/triage-labels.md
@@ -12,6 +12,6 @@ The skills speak in terms of five canonical triage roles. This file maps those r
When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table.
-An issue that shows on some platforms only gets one label per affected platform: `macos`, `windows`, `linux`. An issue on every platform gets none.
+An issue that shows on some platforms only gets one label per affected platform: `platform:macos`, `platform:windows`, `platform:linux`. An issue on every platform gets none. The issue forms ask for the platform and `.github/workflows/issue-platform-labels.yml` sets these labels from the answer.
Edit the "Label in our tracker" column to match whatever vocabulary you actually use.