layui/.github/workflows/issue-closed.yml
贤心 1fdc84c498
ci(issue): 新增和优化多个 workflow (#1475)
* chore: 增加 issue 模板特定标识

* ci(issue): 修改 issue 不活跃状态天数

* refactor: 修改 Issue Labeled 任务变量名

* style: 段落优化

* ci: 新增 Issue 创建和编辑时的 action

* ci: 新增 Issue 关闭时的 action
2023-12-20 11:32:42 +08:00

35 lines
970 B
YAML

name: Issue Closed
on:
issues:
types: [closed]
jobs:
issue-closed:
runs-on: ubuntu-latest
steps:
# 追加标签
- name: Add labels
id: label-check
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const config = {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
};
const issue = await github.rest.issues.get(config);
// 是否带有 `bug` 标签
const hasBugLabel = issue.data.labels.some(label => label.name === 'bug');
// 对带有 `bug` 标签的 issue 追加 `resolved` 标签,表示 bug 已解决。
if (hasBugLabel) {
github.rest.issues.addLabels({
...config,
labels: ['resolved']
});
}