The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 07:00 UTC
perf(ci): thread transfer report stops paging all main CI runs (#23633)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Victor Vogel committed
Nov 1, 2026 at 15:59 UTC
fc1d604e393196382d67a905e19474130af32028
2 files changed
+34
-16
.github/scripts/thread-transfer-report.cjs
+21
-11
@@ -300,18 +300,28 @@ async function resolve({ github, context, core }) {
300
core.setOutput("publish", "false");
301
return;
302
}
303
- const workflowRuns = await github.paginate(github.rest.actions.listWorkflowRuns, {
304
- owner,
305
- repo,
306
- workflow_id: source.workflow_id,
307
- branch: pull.base.ref,
308
- event: "push",
309
- status: "success",
310
- per_page: 100,
311
- });
303
+ // One page each for the exact base and the newest runs; paging through
304
+ // every successful main run costs up to ten requests to keep 20.
305
+ const listRuns = async (filters) => {
306
+ const { data } = await github.rest.actions.listWorkflowRuns({
307
+ owner,
308
+ repo,
309
+ workflow_id: source.workflow_id,
310
+ branch: pull.base.ref,
311
+ event: "push",
312
+ status: "success",
313
+ per_page: 20,
314
+ ...filters,
315
+ });
316
+ return data.workflow_runs;
317
+ };
318
+ const [baseRuns, recentRuns] = await Promise.all([
319
+ listRuns({ head_sha: pull.base.sha }),
320
+ listRuns({}),
321
+ ]);
322
const orderedRuns = [
313
- ...workflowRuns.filter((run) => run.head_sha === pull.base.sha),
314
- ...workflowRuns.filter((run) => run.head_sha !== pull.base.sha),
323
+ ...baseRuns,
324
+ ...recentRuns.filter((run) => run.head_sha !== pull.base.sha),
325
].slice(0, 20);
326
327
let baselineRun;
.github/scripts/thread-transfer-report.test.cjs
+13
-5
@@ -55,7 +55,18 @@ test("validates the fixed artifact schema", () => {
55
test("resolves a fallback PR with a redacted head repo and exact main baseline", async () => {
56
const outputs = {};
57
const listWorkflowRunArtifacts = () => {};
58
- const listWorkflowRuns = () => {};
58
+ // The exact base run sits far past the newest page of main CI runs.
59
+ const mainRuns = Array.from({ length: 1_000 }, (_, index) => ({
60
+ id: 1_000 - index,
61
+ head_sha: index === 900 ? "base-sha" : `main-sha-${index}`,
62
+ }));
63
+ const listWorkflowRuns = async ({ head_sha, per_page }) => ({
64
+ data: {
65
+ workflow_runs: mainRuns
66
+ .filter((run) => head_sha === undefined || run.head_sha === head_sha)
67
+ .slice(0, per_page),
68
+ },
69
+ });
70
const listPullRequestsAssociatedWithCommit = () => {};
71
const github = {
72
paginate: async (method, input) => {
@@ -77,9 +88,6 @@ test("resolves a fallback PR with a redacted head repo and exact main baseline",
88
},
89
];
90
}
80
- if (method === listWorkflowRuns) {
81
- return [{ id: 1, head_sha: "base-sha" }];
82
- }
91
throw new Error("unexpected pagination call");
92
},
93
rest: {
@@ -123,7 +131,7 @@ test("resolves a fallback PR with a redacted head repo and exact main baseline",
131
assert.equal(outputs.publish, "true");
132
assert.equal(outputs.pull_number, "5350");
133
assert.equal(outputs.pr_artifact, "true");
126
- assert.equal(outputs.baseline_run_id, "1");
134
+ assert.equal(outputs.baseline_run_id, "100");
135
assert.equal(outputs.baseline_matches_base, "true");
136
});
137