diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..756f34b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: 使用问题 / 求助 + url: https://github.com/tiajinsha/JKVideo/discussions + about: 使用上的疑问请到 Discussions 提问 diff --git a/.github/workflows/close-invalid-issues.yml b/.github/workflows/close-invalid-issues.yml new file mode 100644 index 0000000..c641958 --- /dev/null +++ b/.github/workflows/close-invalid-issues.yml @@ -0,0 +1,87 @@ +name: Auto Close Invalid Issues + +on: + issues: + types: [opened] + +jobs: + check-issue: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/github-script@v7 + with: + script: | + const { owner, repo } = context.repo; + const issue_number = context.payload.issue.number; + const title = (context.payload.issue.title || '').toLowerCase(); + const body = (context.payload.issue.body || '').toLowerCase(); + const text = title + ' ' + body; + + // --- 第一层:攻击性内容 --- + const abusiveWords = [ + '傻逼','sb','垃圾','废物','狗屎','他妈','滚','草泥马', + 'fuck','shit','操你','你妈','去死','蠢货','弱智','脑残', + '煞笔','白痴','混蛋','烂货','简历','个人信息','B站','假' + ]; + const isAbusive = abusiveWords.some(w => text.includes(w)); + + if (isAbusive) { + await github.rest.issues.createComment({ + owner, repo, issue_number, + body: [ + '你好,', + '', + '此 Issue 包含不文明内容,已自动关闭。', + '', + '我们欢迎任何建设性的反馈,但请保持礼貌和尊重。', + '如有 Bug 或功能建议,请使用官方模板重新提交,谢谢。', + ].join('\n'), + }); + await github.rest.issues.update({ + owner, repo, issue_number, + state: 'closed', + state_reason: 'not_planned', + }); + await github.rest.issues.addLabels({ + owner, repo, issue_number, + labels: ['invalid'], + }); + return; + } + + // --- 第二层:未走模板 --- + const templateMarkers = [ + '### 运行平台', + '### 问题描述', + '### 复现步骤', + '### 需求背景', + '### 建议方案', + ]; + const isFromTemplate = templateMarkers.some(m => body.includes(m.toLowerCase())); + + if (!isFromTemplate) { + await github.rest.issues.createComment({ + owner, repo, issue_number, + body: [ + '感谢你的反馈!', + '', + '此 Issue 未按照模板填写,已自动关闭。', + '', + '请使用以下方式重新提交:', + '- 🐛 **Bug 报告** → 使用 [Bug 报告模板](../../issues/new?template=bug_report.yml)', + '- 💡 **功能建议** → 使用 [功能建议模板](../../issues/new?template=feature_request.yml)', + '- 💬 **使用咨询** → 前往 [Discussions](../../discussions) 提问', + ].join('\n'), + }); + await github.rest.issues.update({ + owner, repo, issue_number, + state: 'closed', + state_reason: 'not_planned', + }); + await github.rest.issues.addLabels({ + owner, repo, issue_number, + labels: ['invalid'], + }); + }