Skip to content

Commit 6a14457

Browse files
Merge pull request #53 from loss-and-quick/chore/issue-platform-badges
ci: auto-label issues by platform
2 parents e580adb + a0f1255 commit 6a14457

2 files changed

Lines changed: 55 additions & 7 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ body:
66
attributes:
77
value: |
88
Thanks for the report! Kasumi Proxy runs on **rooted Android** (a
9-
Magisk / KernelSU / APatch module) and on **Linux desktop** (a Tauri app).
10-
Please fill in the environment fields — most issues are platform,
11-
root-method, or core specific.
9+
Magisk / KernelSU / APatch module) and on **Linux / Windows desktop** (a
10+
Tauri app). Please fill in the environment fields — most issues are
11+
platform, root-method, or core specific.
1212
1313
- type: checkboxes
1414
id: preflight
@@ -27,6 +27,7 @@ body:
2727
options:
2828
- Android (root module)
2929
- Linux desktop (Tauri app)
30+
- Windows desktop (Tauri app)
3031
validations:
3132
required: true
3233

@@ -43,8 +44,8 @@ body:
4344
id: os
4445
attributes:
4546
label: OS / device
46-
description: Android → version + device/ROM; Linux → distro + desktop/compositor (X11/Wayland).
47-
placeholder: "Android 14 — Pixel 7 (stock) · or · NixOS — Hyprland (Wayland)"
47+
description: Android → version + device/ROM; Linux → distro + desktop/compositor (X11/Wayland); Windows → edition + build.
48+
placeholder: "Android 14 — Pixel 7 (stock) · NixOS — Hyprland (Wayland) · Windows 11 23H2"
4849
validations:
4950
required: true
5051

@@ -53,7 +54,7 @@ body:
5354
attributes:
5455
label: Root solution (Android only)
5556
options:
56-
- "N/A — Linux desktop"
57+
- "N/A — Linux / Windows desktop"
5758
- Magisk
5859
- KernelSU
5960
- APatch
@@ -97,5 +98,5 @@ body:
9798
id: logs
9899
attributes:
99100
label: Relevant logs
100-
description: From the Web UI / desktop **Logs** page, or `/data/adb/kasumi-proxy/` (Android) / `$XDG_DATA_HOME/kasumi-proxy/` (desktop). Redact secrets (UUIDs, passwords, server addresses).
101+
description: From the Web UI / desktop **Logs** page, or `/data/adb/kasumi-proxy/` (Android) / `$XDG_DATA_HOME/kasumi-proxy/` (Linux) / `%APPDATA%\kasumi-proxy\` (Windows). Redact secrets (UUIDs, passwords, server addresses).
101102
render: shell
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Label platform
2+
3+
# Issue Forms can't set a label from a dropdown answer, so derive the platform
4+
# label from the rendered "Platform" field of a bug report. Runs on open/edit and
5+
# keeps exactly one platform:* label in sync with the chosen option.
6+
on:
7+
issues:
8+
types: [opened, edited]
9+
10+
permissions:
11+
issues: write
12+
13+
jobs:
14+
label:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
18+
with:
19+
script: |
20+
const body = context.payload.issue.body || "";
21+
// The bug form renders the dropdown as a "### Platform" section.
22+
const m = body.match(/#+\s*Platform\s*\n+\s*([^\n]+)/i);
23+
const answer = m ? m[1].trim().toLowerCase() : "";
24+
const map = [
25+
{ needle: "android", label: "platform:android" },
26+
{ needle: "linux", label: "platform:linux" },
27+
{ needle: "windows", label: "platform:windows" },
28+
];
29+
const want = map.find((e) => answer.includes(e.needle));
30+
const all = map.map((e) => e.label);
31+
32+
const current = context.payload.issue.labels.map((l) => l.name);
33+
const stale = current.filter((l) => all.includes(l) && l !== want?.label);
34+
for (const label of stale) {
35+
await github.rest.issues.removeLabel({
36+
...context.repo,
37+
issue_number: context.issue.number,
38+
name: label,
39+
}).catch(() => {});
40+
}
41+
if (want && !current.includes(want.label)) {
42+
await github.rest.issues.addLabels({
43+
...context.repo,
44+
issue_number: context.issue.number,
45+
labels: [want.label],
46+
});
47+
}

0 commit comments

Comments
 (0)