fix(Step9): 還原嚴重問題失敗流程
AI / 計算版本號 (pull_request) Successful in 2s
AI / Code Review (pull_request) Successful in 35s

This commit is contained in:
2026-06-22 15:48:19 +00:00
parent e443096325
commit 47b5b7ea5c
4 changed files with 4 additions and 55 deletions
+2 -11
View File
@@ -1,7 +1,7 @@
import path from 'path';
import { GITEA_REPOSITORY, PR_NUMBER, PR_HEAD_BRANCH, PR_BASE_BRANCH, getLLMConfig, FINDINGS_PATH, EXCLUSIONS_PATH } from './config.js';
import { loadRoles, getRoleIntro } from './roles.js';
import { getPRDiff, postComment, getCommitMessageBySha, getBotReviewOutcome, shouldSkipBotCommit, blockPRMergeWithStatus } from './gitea.js';
import { getPRDiff, postComment, getCommitMessageBySha, getBotReviewOutcome, shouldSkipBotCommit } from './gitea.js';
import { analyzeWithRole, loadOldFindings, mergeFindings, sortByLevel, deduplicateWithAI, loadExclusions, applyExclusions, filterFalsePositivesWithAI } from './findings.js';
import { saveFindings, postFindingsReview } from './comments.js';
import { cloneRepo, commitAndPush, getRepoState } from './git.js';
@@ -145,16 +145,7 @@ async function main() {
step('Step9', '嚴重問題檢查');
const criticalCount = filtered.filter(f => f.level === 'critical').length;
if (criticalCount > 0) {
error(`發現 ${criticalCount} 個嚴重問題`);
try {
await blockPRMergeWithStatus({ sha: headSha, criticalCount });
ok('已透過 Gitea API 建立 failure status 阻擋 PR 合併');
section('Pipeline 結束');
process.exit(0);
} catch (e) {
warn(`透過 Gitea API 阻擋 PR 合併失敗,改用原本 workflow failure 處理: ${e.message}`);
}
error('workflow 結束(exit 1');
error(`發現 ${criticalCount} 個嚴重問題workflow 結束(exit 1`);
section('Pipeline 結束');
process.exit(1);
}