@spaceflow/review 5.0.2 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +10 -3
- package/package.json +1 -1
- package/src/review-result-model.ts +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.0.2](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@5.0.1...@spaceflow/review@5.0.2) (2026-04-14)
|
|
4
|
+
|
|
5
|
+
### 代码重构
|
|
6
|
+
|
|
7
|
+
* **review:** 重构问题统计逻辑,修正 pending 计算并复用 calculateIssueStats ([23ddcac](https://github.com/Lydanne/spaceflow/commit/23ddcac7f4d8cf59b295b9b370e15d3a7058eecf))
|
|
8
|
+
|
|
9
|
+
### 其他修改
|
|
10
|
+
|
|
11
|
+
* **review-summary:** released version 5.0.1 [no ci] ([41d770e](https://github.com/Lydanne/spaceflow/commit/41d770e9800defbf1f37d15de6a889df598d45ae))
|
|
12
|
+
* **scripts:** released version 5.0.1 [no ci] ([f527047](https://github.com/Lydanne/spaceflow/commit/f5270478d4a85ec19c2cc2ad6028972909fd7320))
|
|
13
|
+
* **shell:** released version 5.0.1 [no ci] ([e04c907](https://github.com/Lydanne/spaceflow/commit/e04c907ae9bd38a73506f9f93ca21ee97a05c606))
|
|
14
|
+
|
|
3
15
|
## [5.0.1](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@5.0.0...@spaceflow/review@5.0.1) (2026-04-14)
|
|
4
16
|
|
|
5
17
|
### 修复BUG
|
package/dist/index.js
CHANGED
|
@@ -2544,7 +2544,7 @@ function generateIssueKey(issue) {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
try {
|
|
2546
2546
|
const reactions = await this.pr.getReviewCommentReactions(comment.id);
|
|
2547
|
-
if (reactions.length === 0 || !matchedIssue) continue;
|
|
2547
|
+
if (!reactions || reactions.length === 0 || !matchedIssue) continue;
|
|
2548
2548
|
// 按 content 分组,收集每种 reaction 的用户列表
|
|
2549
2549
|
const reactionMap = new Map();
|
|
2550
2550
|
for (const r of reactions){
|
|
@@ -2720,8 +2720,10 @@ function generateIssueKey(issue) {
|
|
|
2720
2720
|
outputFormat: "markdown",
|
|
2721
2721
|
ci: true
|
|
2722
2722
|
});
|
|
2723
|
-
// 获取 PR 信息以获取 head commit SHA
|
|
2724
|
-
const
|
|
2723
|
+
// 获取 PR 信息以获取 head commit SHA(同时缓存 PR 状态,供后续 closed 检查复用)
|
|
2724
|
+
const prInfo = await this.pr.getInfo().catch(()=>null);
|
|
2725
|
+
const prIsClosed = prInfo?.state === "closed" || !!prInfo?.merged;
|
|
2726
|
+
const commitId = prInfo?.head?.sha || "HEAD";
|
|
2725
2727
|
// 1. 发布或更新主评论(使用 Issue Comment API,支持删除和更新)
|
|
2726
2728
|
try {
|
|
2727
2729
|
if (existingComments.length > 0) {
|
|
@@ -2747,6 +2749,11 @@ function generateIssueKey(issue) {
|
|
|
2747
2749
|
console.warn("⚠️ 发布/更新 AI Review 评论失败:", error);
|
|
2748
2750
|
}
|
|
2749
2751
|
// 2. 发布本轮新发现的行级评论(使用 PR Review API)
|
|
2752
|
+
// PR 已关闭/合并时无法提交行级 Review,直接跳过
|
|
2753
|
+
if (prIsClosed) {
|
|
2754
|
+
console.log(`ℹ️ PR #${this.pr.number} 已关闭/合并,跳过行级 Review 提交`);
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2750
2757
|
// 保留旧轮次的 review 历史,但清理同轮次的旧 AI review(重复触发场景)
|
|
2751
2758
|
// 如果启用 autoApprove 且所有问题已解决,使用 APPROVE event 合并发布
|
|
2752
2759
|
await this.cleanupDuplicateRoundReviews(this._result.round, verbose);
|
package/package.json
CHANGED
|
@@ -368,7 +368,7 @@ export class ReviewResultModel {
|
|
|
368
368
|
}
|
|
369
369
|
try {
|
|
370
370
|
const reactions = await this.pr.getReviewCommentReactions(comment.id);
|
|
371
|
-
if (reactions.length === 0 || !matchedIssue) continue;
|
|
371
|
+
if (!reactions || reactions.length === 0 || !matchedIssue) continue;
|
|
372
372
|
// 按 content 分组,收集每种 reaction 的用户列表
|
|
373
373
|
const reactionMap = new Map<string, string[]>();
|
|
374
374
|
for (const r of reactions) {
|
|
@@ -585,8 +585,10 @@ export class ReviewResultModel {
|
|
|
585
585
|
ci: true,
|
|
586
586
|
});
|
|
587
587
|
|
|
588
|
-
// 获取 PR 信息以获取 head commit SHA
|
|
589
|
-
const
|
|
588
|
+
// 获取 PR 信息以获取 head commit SHA(同时缓存 PR 状态,供后续 closed 检查复用)
|
|
589
|
+
const prInfo = await this.pr.getInfo().catch(() => null);
|
|
590
|
+
const prIsClosed = prInfo?.state === "closed" || !!prInfo?.merged;
|
|
591
|
+
const commitId = prInfo?.head?.sha || "HEAD";
|
|
590
592
|
|
|
591
593
|
// 1. 发布或更新主评论(使用 Issue Comment API,支持删除和更新)
|
|
592
594
|
try {
|
|
@@ -612,6 +614,12 @@ export class ReviewResultModel {
|
|
|
612
614
|
}
|
|
613
615
|
|
|
614
616
|
// 2. 发布本轮新发现的行级评论(使用 PR Review API)
|
|
617
|
+
// PR 已关闭/合并时无法提交行级 Review,直接跳过
|
|
618
|
+
if (prIsClosed) {
|
|
619
|
+
console.log(`ℹ️ PR #${this.pr.number} 已关闭/合并,跳过行级 Review 提交`);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
|
|
615
623
|
// 保留旧轮次的 review 历史,但清理同轮次的旧 AI review(重复触发场景)
|
|
616
624
|
// 如果启用 autoApprove 且所有问题已解决,使用 APPROVE event 合并发布
|
|
617
625
|
await this.cleanupDuplicateRoundReviews(this._result.round, verbose);
|