@@ -2,6 +2,7 @@ name: "Issue Labeler"
22on :
33 issues :
44 types : [opened, edited]
5+ workflow_dispatch : # <--- ЭТА СТРОЧКА ВКЛЮЧАЕТ КНОПКУ
56
67jobs :
78 triage :
@@ -10,29 +11,41 @@ jobs:
1011 - uses : actions/github-script@v6
1112 with :
1213 script : |
13- const body = context.payload.issue.body.toLowerCase();
14- const labels = [];
15-
16- // Проверка ОС
17- if (body.includes("windows")) labels.push("Windows");
18- if (body.includes("macos")) labels.push("macOS");
19- if (body.includes("linux")) labels.push("Linux");
20-
21- // Проверка статуса игры
22- if (body.includes("playable")) labels.push("Playable");
23- if (body.includes("platinum")) labels.push("Platinum");
24- if (body.includes("orange status")) labels.push("Orange Status");
25- if (body.includes("error/crash")) labels.push("Error/Crash");
26- if (body.includes("in-game")) labels.push("In-Game");
27-
28- // Проверка типа копии
29- if (body.includes("unofficial/pirated")) labels.push("Pirated/Unofficial");
14+ async function labelIssue(issueNumber, issueBody) {
15+ const body = (issueBody || "").toLowerCase();
16+ const labels = [];
17+
18+ if (body.includes("windows")) labels.push("Windows");
19+ if (body.includes("macos")) labels.push("macOS");
20+ if (body.includes("linux")) labels.push("Linux");
21+
22+ if (body.includes("playable")) labels.push("Playable");
23+ if (body.includes("platinum")) labels.push("Platinum");
24+ if (body.includes("orange status")) labels.push("Orange Status");
25+ if (body.includes("error/crash")) labels.push("Error/Crash");
26+ if (body.includes("in-game")) labels.push("In-Game");
27+
28+ if (body.includes("unofficial/pirated")) labels.push("Pirated/Unofficial");
3029
31- if (labels.length > 0) {
32- await github.rest.issues.addLabels({
30+ if (labels.length > 0) {
31+ await github.rest.issues.addLabels({
32+ owner: context.repo.owner,
33+ repo: context.repo.repo,
34+ issue_number: issueNumber,
35+ labels: labels
36+ });
37+ }
38+ }
39+
40+ if (context.eventName === 'workflow_dispatch') {
41+ const issues = await github.rest.issues.listForRepo({
3342 owner: context.repo.owner,
3443 repo: context.repo.repo,
35- issue_number: context.issue.number,
36- labels: labels
44+ state: 'open'
3745 });
46+ for (const issue of issues.data) {
47+ await labelIssue(issue.number, issue.body);
48+ }
49+ } else {
50+ await labelIssue(context.issue.number, context.payload.issue.body);
3851 }
0 commit comments