Skip to content

Issue Labeler

Issue Labeler #2

Workflow file for this run

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);
}