Skip to content

Commit

Permalink
从新整理issue模板规范要求
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-chu committed May 25, 2024
1 parent 9424584 commit 8d3b46a
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 39 deletions.
22 changes: 15 additions & 7 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ assignees: ''
* https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
-->

### 现象描述
## 现象描述

<!--
在使用什么功能产生的问题? 其异常表现是什么?
如: 在测试 WebRTC 功能时, 使用 Chrome 浏览器访问 ZLMediait 自带网页播放 FFmpeg 以 RTSP 协议推送的图像有卡顿/花屏.
-->

### 如何复现?
## 如何复现?

<!--
明确的复现步骤对快速解决问题极有帮助.
Expand All @@ -37,7 +37,7 @@ assignees: ''
1. 期望 ..., 结果 ...
-->

### 相关日志或截图
## 相关日志或截图

<!--
由于日志通长较长, 建议将日志信息填写到下面的 "日志内容..."
Expand All @@ -50,11 +50,13 @@ assignees: ''
<details>
<summary>展开查看详细日志</summary>
<pre>
日志内容...
```
#详细日志粘在这里!
```
</pre>
</details>

### 配置
## 配置

<!--
部分常见问题是由于配置错误导致的, 建议仔细阅读配置文件中的注释信息
Expand All @@ -65,11 +67,13 @@ assignees: ''
<details>
<summary>展开查看详细配置</summary>
<pre>
配置内容...
```ini
#config.ini内容粘在这里!
```
</pre>
</details>

### 各种环境信息
## 各种环境信息

<!--
请填写相关环境信息, 详细的环境信息有助于快速复现定位问题.
Expand All @@ -82,4 +86,8 @@ assignees: ''
* **代码提交记录/git commit hash**:
* **操作系统及版本**:
* **硬件信息**:
* **crash backtrace**:
```
#崩溃信息backtrace粘贴至此
```
* **其他需要补充的信息**:
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ assignees: ''
* https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
-->

### 相关日志及环境信息
## 相关日志及环境信息

<!--
由于编译日志通长较长, 建议将日志信息填写到下面 `````` block 内,或者上传日志文件
Expand All @@ -41,7 +41,7 @@ assignees: ''

编译目录下的 `CMakeCache.txt` 文件内容,请直接上传为附件。

### 各种环境信息
## 各种环境信息

<!--
请填写相关环境信息, 详细的环境信息有助于快速复现定位问题.
Expand Down
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
blank_issues_enabled: false

contact_links:
- name: 技术咨询
url: https://t.zsxq.com/FcVK5
about: 请在知识星球发起技术咨询
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ assignees: ''

---

**描述该功能的用处,可以提供相关资料描述该功能**
## 描述该功能的用处,可以提供相关资料描述该功能

**该功能是否用于改进项目缺陷,如果是,请描述现有缺陷**
## 该功能是否用于改进项目缺陷,如果是,请描述现有缺陷

**描述你期望实现该功能的方式和最终效果**
## 描述你期望实现该功能的方式和最终效果
19 changes: 0 additions & 19 deletions .github/ISSUE_TEMPLATE/question.md

This file was deleted.

8 changes: 0 additions & 8 deletions .github/ISSUE_TEMPLATE/requirement.md

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/issue_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: issue_lint

on:
issues:
types: [opened]

jobs:
issue_lint:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs').promises;
const getTitles = (str) => (
[...str.matchAll(/^## (.*)/gm)].map((m) => m[0])
);
const titles = getTitles(context.payload.issue.body);
for (let file of await fs.readdir('.github/ISSUE_TEMPLATE')) {
if (!file.endsWith('.md')) {
continue;
}
const template = await fs.readFile(`.github/ISSUE_TEMPLATE/${file}`, 'utf-8');
const templateTitles = getTitles(template);
if (templateTitles.every((title) => titles.includes(title))) {
process.exit(0);
}
}
await github.rest.issues.createComment({
owner: context.issue.owner,
repo: context.issue.repo,
issue_number: context.issue.number,
body: '此issue由于不符合模板规范已经自动关闭,请重新按照模板规范确保包含模板中所有章节标题再提交\n',
});
await github.rest.issues.update({
owner: context.issue.owner,
repo: context.issue.repo,
issue_number: context.issue.number,
state: 'closed',
});

0 comments on commit 8d3b46a

Please sign in to comment.