aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/issue-checkbox-checker.yml
diff options
context:
space:
mode:
authorBegonia, HE <163421589+BegoniaHe@users.noreply.github.com>2026-01-16 04:01:19 +0100
committerBegonia, HE <163421589+BegoniaHe@users.noreply.github.com>2026-01-16 04:01:19 +0100
commit83027c383f26f772842771a6d670642fd36c269a (patch)
tree798f34d2a18c331b16ce6daf39b3f0dae3a8d924 /.github/workflows/issue-checkbox-checker.yml
parent88d2b67870203acc098ae09e3cc33009c4e6b6ad (diff)
downloadDropOut-83027c383f26f772842771a6d670642fd36c269a.tar.gz
DropOut-83027c383f26f772842771a6d670642fd36c269a.zip
chore: add GitHub issue and PR templates with automation workflows
- Add bilingual issue templates (English & Chinese) - Bug report template with prerequisite checkboxes - Feature request template - Question template - Reverse checkbox detection ("I have not read carefully") - Add bilingual PR templates (English & Chinese) - Comprehensive checklist for code quality and testing - Test environment documentation section - Breaking changes section - Add GitHub Actions workflows - Auto-labeling based on issue content - Auto-close issues with unchecked prerequisites - Stale issue and PR management (90/60 days) - Add template configuration - External links for discussions and wiki - Template chooser interface
Diffstat (limited to '.github/workflows/issue-checkbox-checker.yml')
-rw-r--r--.github/workflows/issue-checkbox-checker.yml104
1 files changed, 104 insertions, 0 deletions
diff --git a/.github/workflows/issue-checkbox-checker.yml b/.github/workflows/issue-checkbox-checker.yml
new file mode 100644
index 0000000..ce7e011
--- /dev/null
+++ b/.github/workflows/issue-checkbox-checker.yml
@@ -0,0 +1,104 @@
+name: Issue Checkbox Checker
+
+on:
+ issues:
+ types: [opened, edited]
+
+permissions:
+ issues: write
+
+jobs:
+ check-checkboxes:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check for unchecked prerequisites
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const issue = context.payload.issue;
+ if (!issue) return;
+
+ const body = issue.body || '';
+
+ // Check if "I have not read carefully" checkbox is checked
+ const notReadPatterns = [
+ /- \[[xX]\] I have not read carefully/,
+ /- \[[xX]\] 我未仔细阅读/
+ ];
+
+ const hasNotReadChecked = notReadPatterns.some(pattern => pattern.test(body));
+
+ if (hasNotReadChecked) {
+ const closeMessage = [
+ '## Issue Automatically Closed / Issue 已自动关闭',
+ '',
+ '**English:**',
+ 'This issue has been automatically closed because you checked "I have not read carefully."',
+ '',
+ 'Please:',
+ '1. Read the [README](https://github.com/' + context.repo.owner + '/' + context.repo.repo + '/blob/main/README.md) and documentation carefully',
+ '2. Search for existing issues',
+ '3. Fill out the issue template completely',
+ '4. Submit a new issue when ready',
+ '',
+ '**中文:**',
+ '此 Issue 已被自动关闭,因为您勾选了"我未仔细阅读"。',
+ '',
+ '请:',
+ '1. 仔细阅读 [README](https://github.com/' + context.repo.owner + '/' + context.repo.repo + '/blob/main/README.md) 和文档',
+ '2. 搜索现有 Issue',
+ '3. 完整填写 Issue 模板',
+ '4. 准备好后提交新的 Issue',
+ '',
+ '---',
+ '*This is an automated action. If you believe this was done in error, please contact the maintainers.*'
+ ].join('\n');
+
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ body: closeMessage
+ });
+
+ await github.rest.issues.update({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ state: 'closed',
+ state_reason: 'not_planned'
+ });
+
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ labels: ['invalid', 'auto-closed']
+ });
+
+ return;
+ }
+
+ // Count total checkboxes and checked boxes
+ const totalBoxes = (body.match(/- \[[ xX]\]/g) || []).length;
+ const checkedBoxes = (body.match(/- \[[xX]\]/g) || []).length;
+
+ // If no boxes are checked in prerequisites, add a reminder
+ if (totalBoxes > 0 && checkedBoxes === 0) {
+ const reminderMessage = [
+ '## Reminder / 提醒',
+ '',
+ '**English:**',
+ 'Please check the prerequisite boxes in the issue template to confirm you have completed the required steps.',
+ '',
+ '**中文:**',
+ '请勾选 Issue 模板中的前置条件复选框,以确认您已完成必要步骤。'
+ ].join('\n');
+
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ body: reminderMessage
+ });
+ }