/
githubmirror
/
acme.sh
Обзор
Документация
Войти
/
githubmirror
/
acme.sh
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
.github/workflows/issue.yml
129 строк
5 KB
neil
minor
16 июл 2026, 15:09
16 июл 2026, 15:09
745a42f
Код
Авторство
О чём код?
name: "Update issues" on: issues: types: [opened] issue_comment: types: [created] pull_request_target: types: [opened] permissions: issues: write pull-requests: write jobs: comment: runs-on: ubuntu-latest steps: - uses: actions/github-script@v9 with: script: | const item = context.payload.issue || context.payload.pull_request; // Close on sight anything opened by a user on the wiki Blacklist // page (maintained by the Wiki Guard workflow). let blacklist = []; try { const res = await fetch(`https://raw.githubusercontent.com/wiki/${context.repo.owner}/${context.repo.repo}/Blacklist.md`); if (res.ok) { blacklist = (await res.text()).split("\n") .filter(l => l.startsWith("- ")) .map(l => l.slice(2).trim().toLowerCase()) .filter(Boolean); } } catch (e) { core.warning(`Failed to fetch the blacklist: ${e}`); } // A comment on a closed tracking issue reopens it (the standard // closing note promises this). Bots, blacklisted users and the // maintainer's own comments don't reopen. if (context.eventName === "issue_comment") { const issue = context.payload.issue; const commenter = context.payload.comment.user; if (issue.pull_request || issue.state !== "closed") { return; } if (!/^report\s+(bugs?|issues?)\b/i.test(issue.title)) { return; } if (commenter.type === "Bot" || commenter.login.toLowerCase() === "neilpang" || blacklist.includes(commenter.login.toLowerCase())) { return; } await github.rest.issues.update({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, state: "open" }); return; } if (blacklist.includes(item.user.login.toLowerCase())) { if (context.payload.pull_request) { await github.rest.pulls.update({ owner: context.repo.owner, repo: context.repo.repo, pull_number: item.number, state: "closed" }); } else { await github.rest.issues.update({ owner: context.repo.owner, repo: context.repo.repo, issue_number: item.number, state: "closed", state_reason: "not_planned" }); } return; } if (context.payload.pull_request) { return; } const issue = context.payload.issue; if (issue.title.startsWith("blacklist:") || issue.title.startsWith("revert:")) { // Handled by the Blacklist / Revert Command workflows. return; } if (/^report\s+(bugs?|issues?)\b/i.test(issue.title)) { // Tracking issue for a third-party dns/deploy/notify api: // no upgrade boilerplate; assign it to the opener, label it, // then close it right away to keep the issue list clean. Any // later comment reopens it (see the issue_comment handler). await github.rest.issues.addAssignees({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, assignees: [issue.user.login] }); await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, labels: ["3rd party api"] }); await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, body: "Closing this tracking issue for now to keep the issue list clean. It remains the place to report problems with this provider -- if you hit a bug, comment here and the issue will be reopened." }); await github.rest.issues.update({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issue.number, state: "closed", state_reason: "completed" }); return; } await github.rest.issues.createComment({ issue_number: issue.number, owner: context.repo.owner, repo: context.repo.repo, body: "Please upgrade to the latest code and try again first. Maybe it's already fixed. ```acme.sh --upgrade``` If it's still not working, please provide the log with `--debug 2`, otherwise, nobody can help you. Before posting the log, review it and REDACT any secrets: private keys (`-----BEGIN ... PRIVATE KEY-----` blocks), API tokens and passwords." })