mirror of
https://gitee.com/layui/layui.git
synced 2025-04-05 17:38:02 +08:00

* ci(issue): 增加 duplicate 标签的定时关闭任务 * docs(issue): 优化 discussion 标签文案 * ci: 优化 issue 被创建和被编辑时的 action 校验逻辑 * refactor(issue-opened): 简化语句 * docs(issue): 优化 bot 回复文案 * Squashed commit of the following: commite5aa6c3a87
Author: morning-star <1453017105@qq.com> Date: Tue Dec 26 22:32:10 2023 +0800 feat(transfer): 新增 `dblclick` 选项 (#1491) * feat(transfer): 新增 `dblclick` 选项 * style(transfer): 优化代码书写风格 --------- Co-authored-by: 贤心 <3277200+sentsim@users.noreply.github.com> commited3bab52e5
Author: morning-star <1453017105@qq.com> Date: Mon Dec 25 14:53:55 2023 +0800 chore(select): 优化搜索面板打开逻辑 (#1498) commit5db18c6f00
Author: 贤心 <3277200+sentsim@users.noreply.github.com> Date: Mon Dec 25 14:52:52 2023 +0800 docs: 优化 issue 模板提示文案 (#1500) commit567a1e70c1
Author: morning-star <1453017105@qq.com> Date: Mon Dec 25 13:22:50 2023 +0800 feat(upload): 加强 data 选项的函数写法,支持获取文件相关数据 (#1494) close https://gitee.com/layui/layui/issues/I8JAC1 commit6abb1eedd8
Author: 贤心 <3277200+sentsim@users.noreply.github.com> Date: Mon Dec 25 12:15:51 2023 +0800 ci: 优化 issue 被创建和被编辑时的 action 校验逻辑 (#1496) * ci(issue): 增加 duplicate 标签的定时关闭任务 * docs(issue): 优化 discussion 标签文案 * ci: 优化 issue 被创建和被编辑时的 action 校验逻辑 * refactor(issue-opened): 简化语句
70 lines
2.3 KiB
YAML
70 lines
2.3 KiB
YAML
name: Issue Opened
|
|
|
|
on:
|
|
issues:
|
|
types: [opened, edited]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
issue-opened:
|
|
permissions:
|
|
issues: write
|
|
pull-requests: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: content template
|
|
id: template
|
|
run: |
|
|
contribute="详见:🍀 [Layui Issue 贡献指南](https://github.com/layui/layui/blob/main/CONTRIBUTING.md)"
|
|
echo "CONTRIBUTING=$contribute" >> $GITHUB_ENV
|
|
|
|
- name: check invalid
|
|
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 payload = context.payload;
|
|
const isCreatedByBot = payload.sender.type === 'Bot';
|
|
const issue = payload.issue;
|
|
const isValid = issue.body?.includes('layui-issue-template');
|
|
|
|
// 跳过 closed 状态的 issues
|
|
if (issue.state === 'closed') {
|
|
return console.log('Issue is closed.');
|
|
}
|
|
|
|
// 若修改的不是内容,则不必校验
|
|
if (payload.action === 'edited') {
|
|
if (payload.changes && !payload.changes.body.from) {
|
|
return console.log('Edited fields exclude "body".');
|
|
}
|
|
}
|
|
|
|
// 不符合规则或由机器人创建
|
|
if (isCreatedByBot || !isValid) {
|
|
if (!isCreatedByBot) {
|
|
github.rest.issues.createComment({
|
|
...config,
|
|
body: `@${payload.sender.login} 你好,为了提升沟通效率,我们对 Issue 制定了严格的要求,你的 Issue 因不符合规定而被自动关闭。
|
|
建议你在下次创建 Issue 时,遵循相应规范和社区行为准则。谢谢。\n > ${process.env.CONTRIBUTING}`
|
|
});
|
|
}
|
|
// 给 issue 添加指定标签和关闭
|
|
github.rest.issues.addLabels({
|
|
...config,
|
|
labels: ['invalid']
|
|
});
|
|
github.rest.issues.update({
|
|
...config,
|
|
state: 'closed'
|
|
});
|
|
}
|