This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Comment automatically when labeled | |
on: | |
issues: | |
types: [labeled] | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Comment on issue | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
const issue = context.issue; | |
const label = context.payload.label; | |
// 定义一个通用的 response function | |
function autoResponse(body) { | |
github.issues.createComment({ | |
issue_number: issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) | |
} | |
if (label.name === "审核通过") { | |
autoResponse("您的申请已通过,欢迎加入开往大家庭~\n当前 Issue 关闭后,您便可以在[开往成员列表](https://list.travellings.cn)搜索到您的网站~\n开往的 QQ 群:186690715,开往的 Telegram 群:[TravellingsCN](https://t.me/TravellingsCN)") | |
} else if (label.name === "信息更改完成") { | |
autoResponse("您申请的站点信息更改已经完成啦~\n请查看[开往成员列表](https://list.travellings.cn/)\n若信息更改前站点状态异常,请等待下一次巡查\n开往的 QQ 群:186690715,开往的 Telegram 群:[TravellingsCN](https://t.me/TravellingsCN)") | |
// 关闭此 issue | |
github.issues.update({ | |
issue_number: issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: "closed" | |
}); | |
} |