pr-shepherd 0.25.3 → 0.25.4
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.
|
@@ -22,6 +22,11 @@ export function extractCheckRunSummary(title, summary) {
|
|
|
22
22
|
?.trim();
|
|
23
23
|
return firstLine || undefined;
|
|
24
24
|
}
|
|
25
|
+
export function latestApprovedLogins(latest) {
|
|
26
|
+
return new Set(latest
|
|
27
|
+
.filter((r) => r.login !== "unknown" && (r.state === "APPROVED" || r.state === "DISMISSED"))
|
|
28
|
+
.map((r) => r.login));
|
|
29
|
+
}
|
|
25
30
|
export function mapStatusContextState(state) {
|
|
26
31
|
switch (state) {
|
|
27
32
|
case "SUCCESS":
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mapAuthorType, parseCreatedAt, extractRunId, extractCheckRunSummary, mapStatusContextState, } from "./batch-parser-helpers.mjs";
|
|
1
|
+
import { mapAuthorType, parseCreatedAt, extractRunId, extractCheckRunSummary, mapStatusContextState, latestApprovedLogins, } from "./batch-parser-helpers.mjs";
|
|
2
2
|
export function parseRawPr(raw, rawThreadPages, rawCommentNodes, rawReviewNodes, rawReviewSummaryNodes, rawApprovedReviewNodes, rawCheckNodes) {
|
|
3
3
|
const reviewRequests = (raw.reviewRequests?.nodes ?? []).flatMap((n) => {
|
|
4
4
|
const login = n.requestedReviewer?.login ?? n.requestedReviewer?.name;
|
|
@@ -8,6 +8,7 @@ export function parseRawPr(raw, rawThreadPages, rawCommentNodes, rawReviewNodes,
|
|
|
8
8
|
login: n.author?.login ?? "unknown",
|
|
9
9
|
state: n.state,
|
|
10
10
|
}));
|
|
11
|
+
const crDone = latestApprovedLogins(latestReviews);
|
|
11
12
|
const reviewThreads = rawThreadPages.map((t) => {
|
|
12
13
|
const comment = t.comments.nodes[0];
|
|
13
14
|
const comments = t.comments.nodes.map((c) => ({
|
|
@@ -46,7 +47,9 @@ export function parseRawPr(raw, rawThreadPages, rawCommentNodes, rawReviewNodes,
|
|
|
46
47
|
url: c.url,
|
|
47
48
|
createdAtUnix: parseCreatedAt(c.createdAt),
|
|
48
49
|
}));
|
|
49
|
-
const changesRequestedReviews = rawReviewNodes
|
|
50
|
+
const changesRequestedReviews = rawReviewNodes
|
|
51
|
+
.filter((r) => !crDone.has(r.author?.login ?? "unknown"))
|
|
52
|
+
.map((r) => ({
|
|
50
53
|
id: r.id,
|
|
51
54
|
author: r.author?.login ?? "unknown",
|
|
52
55
|
authorType: mapAuthorType(r.author?.__typename, r.author?.login),
|
|
@@ -49,6 +49,9 @@ query BatchPr(
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
# Not paginated — capped at 100 distinct reviewers; PRs with more are not plausible
|
|
53
|
+
# in practice. Used to derive which CHANGES_REQUESTED rows are superseded by a later
|
|
54
|
+
# APPROVED/DISMISSED review from the same author.
|
|
52
55
|
latestReviews(last: 100) {
|
|
53
56
|
nodes {
|
|
54
57
|
author {
|
package/package.json
CHANGED