-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.89 KB
/
auto-label.yml
File metadata and controls
51 lines (45 loc) · 1.89 KB
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
47
48
49
50
51
name: "Issue Labeler"
on:
issues:
types: [opened, edited]
workflow_dispatch: # <--- ЭТА СТРОЧКА ВКЛЮЧАЕТ КНОПКУ
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
async function labelIssue(issueNumber, issueBody) {
const body = (issueBody || "").toLowerCase();
const labels = [];
if (body.includes("windows")) labels.push("Windows");
if (body.includes("macos")) labels.push("macOS");
if (body.includes("linux")) labels.push("Linux");
if (body.includes("playable")) labels.push("Playable");
if (body.includes("platinum")) labels.push("Platinum");
if (body.includes("orange status")) labels.push("Orange Status");
if (body.includes("error/crash")) labels.push("Error/Crash");
if (body.includes("in-game")) labels.push("In-Game");
if (body.includes("unofficial/pirated")) labels.push("Pirated/Unofficial");
if (labels.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
labels: labels
});
}
}
if (context.eventName === 'workflow_dispatch') {
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open'
});
for (const issue of issues.data) {
await labelIssue(issue.number, issue.body);
}
} else {
await labelIssue(context.issue.number, context.payload.issue.body);
}