Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/queue/processors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4601,6 +4601,7 @@ async function maybeCaptureOnActionsFallbackWorkflowRun(
}
).workflow_run;
if (run?.name !== FALLBACK_WORKFLOW_NAME || run?.event !== "workflow_dispatch") return false;
if (payload.action !== "completed") return false;

const correlation = parseFallbackRunCorrelation(run.display_title);
if (correlation) {
Expand Down
31 changes: 31 additions & 0 deletions test/unit/actions-fallback-webhook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,37 @@ describe("workflow_run webhook -> actions_fallback storage (#4112)", () => {
expect(artifactsListCalled).toBe(false);
});

it("does not clear the dispatch marker for a non-terminal workflow_run activity", async () => {
const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem(), GITTENSORY_REVIEW_REPOS: "owner/fallback-repo", REVIEW_AUDIT: memoryReviewAudit() });
await seedRepoAndPr(env, "cafebabecafebabecafebabecafebabecafebabe");
await markFallbackDispatched(env, "cafebabecafebabecafebabecafebabecafebabe");
let artifactsListCalled = false;
vi.stubGlobal(
"fetch",
baseFetchStub({
"/actions/runs/": () => {
artifactsListCalled = true;
return Response.json({ artifacts: [] });
},
}),
);

await processJob(env, {
type: "github-webhook",
deliveryId: "requested-run-keeps-marker",
eventName: "workflow_run",
payload: {
action: "requested",
repository: { name: "fallback-repo", full_name: "owner/fallback-repo", owner: { login: "owner" } },
installation: { id: 9101 },
workflow_run: { id: 589, name: "Gittensory Visual Capture Fallback", event: "workflow_dispatch", conclusion: null, display_title: "gittensory-visual-fallback pr=55 sha=cafebabecafebabecafebabecafebabecafebabe" },
},
} as never);

expect(artifactsListCalled).toBe(false);
await expect(isFallbackDispatchInFlight(env, "cafebabecafebabecafebabecafebabecafebabe")).resolves.toBe(true);
});

it("clears the dispatch marker on a FAILED run too (#4112 review fix -- a failed run shouldn't block a retry for the rest of the max-age window)", async () => {
const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem(), GITTENSORY_REVIEW_REPOS: "owner/fallback-repo", REVIEW_AUDIT: memoryReviewAudit() });
await seedRepoAndPr(env, "cafebabecafebabecafebabecafebabecafebabe");
Expand Down