Skip to content

Commit 8984055

Browse files
committed
fix(ci): resolve fork transfer reports
1 parent c8de8e4 commit 8984055

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

‎.github/scripts/thread-transfer-report.cjs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ async function resolve({ github, context, core }) {
252252
(pull) =>
253253
pull.state === "open" &&
254254
pull.head.sha === source.head_sha &&
255-
pull.head.ref === source.head_branch &&
256-
pull.head.repo?.full_name === source.head_repository?.full_name,
255+
pull.head.ref === source.head_branch,
257256
);
258257
if (matchingPulls.length !== 1) {
259258
core.info(

‎.github/scripts/thread-transfer-report.test.cjs‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,22 @@ test("renders baseline, impact, ceiling, and ceiling changes", () => {
8686
);
8787
});
8888

89-
test("resolves the current PR artifact and exact main baseline", async () => {
89+
test("resolves a fallback PR with a redacted head repo and exact main baseline", async () => {
9090
const outputs = {};
9191
const listWorkflowRunArtifacts = () => {};
9292
const listWorkflowRuns = () => {};
93+
const listPullRequestsAssociatedWithCommit = () => {};
9394
const github = {
9495
paginate: async (method, input) => {
96+
if (method === listPullRequestsAssociatedWithCommit) {
97+
return [
98+
{
99+
number: 5350,
100+
state: "open",
101+
head: { sha: "head-sha", ref: "feature-branch", repo: null },
102+
},
103+
];
104+
}
95105
if (method === listWorkflowRunArtifacts) {
96106
return [
97107
{
@@ -116,7 +126,7 @@ test("resolves the current PR artifact and exact main baseline", async () => {
116126
},
117127
}),
118128
},
119-
repos: { listPullRequestsAssociatedWithCommit: () => {} },
129+
repos: { listPullRequestsAssociatedWithCommit },
120130
},
121131
};
122132
await resolve({
@@ -129,8 +139,10 @@ test("resolves the current PR artifact and exact main baseline", async () => {
129139
event: "pull_request",
130140
workflow_id: 3,
131141
head_sha: "head-sha",
142+
head_branch: "feature-branch",
143+
head_repository: { full_name: "pingdotgg/t3code" },
132144
conclusion: "success",
133-
pull_requests: [{ number: 5350 }],
145+
pull_requests: [],
134146
},
135147
},
136148
},

0 commit comments

Comments
 (0)