mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 03:45:46 -06:00
fix(scripts): ignore superseded target dispatch checks (#128704)
This commit is contained in:
committed by
GitHub
parent
41050b2f3b
commit
e45e4ca69f
@@ -320,6 +320,78 @@ describe("watch-pr-ci", () => {
|
||||
).toEqual({ verdict: "PENDING", pendingCount: 2, failingNames: [], supersededCount: 1 });
|
||||
});
|
||||
|
||||
it.each<{
|
||||
label: string;
|
||||
name?: string;
|
||||
conclusion?: string;
|
||||
event?: string | null;
|
||||
workflowId?: number | null;
|
||||
newerRunId?: number;
|
||||
newerWorkflowId?: number | null;
|
||||
ciStatus?: string;
|
||||
verdict?: string;
|
||||
}>([
|
||||
{ label: "pending CI", ciStatus: "IN_PROGRESS", verdict: "PENDING" },
|
||||
{ label: "successful CI with a different check name", name: "target guard", verdict: "GREEN" },
|
||||
{ label: "latest target cancellation", newerRunId: 100 },
|
||||
{ label: "real target failure", conclusion: "FAILURE" },
|
||||
{ label: "another event's cancellation", event: "pull_request" },
|
||||
{ label: "another workflow", newerWorkflowId: 20 },
|
||||
{ label: "unknown event", event: null },
|
||||
{ label: "unknown visible workflow identity", workflowId: null },
|
||||
{ label: "unknown replacement workflow identity", newerWorkflowId: null },
|
||||
])(
|
||||
"uses newer same-workflow target-run identity without hiding $label",
|
||||
({
|
||||
name = "dispatch",
|
||||
conclusion = "CANCELLED",
|
||||
event = "pull_request_target",
|
||||
workflowId = 10,
|
||||
newerRunId = 200,
|
||||
newerWorkflowId = 10,
|
||||
ciStatus = "COMPLETED",
|
||||
verdict = "FAILING",
|
||||
}) => {
|
||||
expect(
|
||||
classifyRollup(
|
||||
{
|
||||
state: "FAILURE",
|
||||
contexts: {
|
||||
nodes: [
|
||||
{
|
||||
kind: "CheckRun",
|
||||
name,
|
||||
status: "COMPLETED",
|
||||
conclusion,
|
||||
checkSuite: {
|
||||
workflowRun: {
|
||||
databaseId: 100,
|
||||
event: event ?? undefined,
|
||||
workflow: { databaseId: workflowId ?? undefined },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
kind: "CheckRun",
|
||||
name: "CI",
|
||||
status: ciStatus,
|
||||
conclusion: ciStatus === "COMPLETED" ? "SUCCESS" : null,
|
||||
checkSuite: { workflowRun: { databaseId: 200, workflow: { databaseId: 20 } } },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
[{ id: newerRunId, workflow_id: newerWorkflowId ?? undefined }],
|
||||
),
|
||||
).toEqual({
|
||||
verdict,
|
||||
pendingCount: ciStatus === "IN_PROGRESS" ? 1 : 0,
|
||||
failingNames: verdict === "FAILING" ? [name] : [],
|
||||
supersededCount: verdict === "FAILING" ? 0 : 1,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it("keeps only the newest same-run check attempt while its replacement is pending", () => {
|
||||
expect(
|
||||
classifyRollup({
|
||||
|
||||
Reference in New Issue
Block a user