2026-5-14 在下载最新的安装包并更新到1.0.0公测版时MFA遇到了问题 #40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Issue Review | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| check-then-close-or-fold: | |
| name: Review and Modify Issues | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Check for duplicate issues in last hour | |
| id: duplicate-check | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const oneHourAgo = new Date(Date.now() - 60 * 60 * 1000); | |
| const currentIssueCreatedAt = new Date(context.payload.issue.created_at); | |
| const issueAuthor = context.payload.issue.user.login; | |
| // 重新获取该用户最近的 issues | |
| const { data: userIssues } = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| creator: issueAuthor, | |
| state: 'all', | |
| since: oneHourAgo.toISOString(), | |
| per_page: 30 | |
| }); | |
| // 过滤出1小时内创建的其他 issues(排除当前 issue) | |
| const recentIssues = userIssues.filter(issue => { | |
| const issueCreatedAt = new Date(issue.created_at); | |
| return issue.number !== context.issue.number && | |
| issueCreatedAt >= oneHourAgo && | |
| issueCreatedAt < currentIssueCreatedAt; | |
| }); | |
| if (recentIssues.length > 0) { | |
| // 给当前 issue 添加标签 | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| labels: ['rapid-submission'] | |
| }); | |
| // 给1小时内的其他 issues 也添加标签 | |
| for (const issue of recentIssues) { | |
| try { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| labels: ['rapid-submission'] | |
| }); | |
| console.log(`Added rapid-submission label to issue #${issue.number}`); | |
| } catch (error) { | |
| console.log(`Failed to add label to issue #${issue.number}: ${error.message}`); | |
| } | |
| } | |
| } | |
| - name: Check for issue checkboxes | |
| id: unread-checkbox-check | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| // 找不到###就算了 | |
| if (!/###([^#]+)###/.test(context.payload.issue.body)) { | |
| return false; | |
| } | |
| var checkList = /###([^#]+)###/.exec(context.payload.issue.body)[1]; | |
| const UnreadRegexCn = /- \[x\]\s*.*?我不知道这个项目是独立的通用GUI项目/i; | |
| const UnreadRegexCn_ = /- \[ \]\s*.*?我不知道这个项目是独立的通用GUI项目/i; | |
| if (/- \[(x| )\]\s*.*?[\u4e00-\u9fa5]+/i.test(checkList)) { // 中英区分 | |
| if (UnreadRegexCn.test(checkList)) { | |
| return true; | |
| } | |
| checkList = checkList.replace(UnreadRegexCn_, ""); | |
| return /- \[ \]\s*.*?[\u4e00-\u9fa5]+/i.test(checkList); | |
| } | |
| const texts = [ | |
| 'I have checked all the options without carefully reading the content and believe this will not affect issue resolution.']; | |
| return texts.some(text => new RegExp(`- \\[x\\]\\s*${text}`).test(context.payload.issue.body)); | |
| - name: Close low-quality issue | |
| if: steps.unread-checkbox-check.outputs.result == 'true' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| state: 'closed', | |
| state_reason: 'not_planned' | |
| }); | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| labels: ['low-quality-report'] | |
| }); | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: '因为未阅读模板提示并正确提交,触发了自动关闭规则\n\nBecause the template prompt was not read and submitted correctly, the automatic closing rule was triggered' | |
| }); | |
| - name: Fold checkboxes | |
| if: steps.unread-checkbox-check.outputs.result == 'false' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const originalBody = context.payload.issue.body; | |
| if (originalBody.includes('<details><summary>Checkboxes</summary>\n\n')) { | |
| return; | |
| } | |
| const checkboxSectionRegex_cn_bug = /([\s\S]*?)(### 问题描述\n\n)/; | |
| const checkboxSectionRegex_cn_feat = /([\s\S]*?)(### 说说你遇到的问题?\n\n)/; | |
| const checkboxSectionRegex_en_bug = /([\s\S]*?)(### Description\n\n)/; | |
| const checkboxSectionRegex_en_feat = /([\s\S]*?)(### The problems you have encountered?\n\n)/; | |
| const foldedBody_cn_bug = originalBody.replace( | |
| checkboxSectionRegex_cn_bug, | |
| `<details><summary>Checkboxes</summary>\n\n$1\n\n</details>\n\n$2` | |
| ); | |
| const foldedBody_cn_feat = foldedBody_cn_bug.replace( | |
| checkboxSectionRegex_cn_feat, | |
| `<details><summary>Checkboxes</summary>\n\n$1\n\n</details>\n\n$2` | |
| ); | |
| const foldedBody_en_bug = foldedBody_cn_feat.replace( | |
| checkboxSectionRegex_en_bug, | |
| `<details><summary>Checkboxes</summary>\n\n$1\n\n</details>\n\n$2` | |
| ); | |
| const foldedBody = foldedBody_en_bug.replace( | |
| checkboxSectionRegex_en_feat, | |
| `<details><summary>Checkboxes</summary>\n\n$1\n\n</details>\n\n$2` | |
| ); | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: foldedBody | |
| }); |