test-e2e-local support useLastSuccessfulPipeline (#47248)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47248

This argument wasn't implemented; this change implements it.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D65066030

fbshipit-source-id: 999fb2fa89cc71f9a568843d4cf92a500ff1b4f8
This commit is contained in:
Blake Friedman 2024-10-29 10:08:07 -07:00 committed by Facebook GitHub Bot
parent 4c0cd72208
commit f5595c716b

View File

@ -25,10 +25,11 @@ type WorkflowRun = {
id: number,
name: string,
run_number: number,
status: string,
status: "queued" | "in_progress" | "completed",
workflow_id: number,
url: string,
created_at: string,
conclusion: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | null,
};
@ -140,7 +141,15 @@ async function initialize(
`https://github.com/facebook/react-native/actions/runs/${testAllWorkflows[0].id}\n`,
);
artifacts = await _getArtifacts(testAllWorkflows[0].id);
let workflow = testAllWorkflows[0];
if (useLastSuccessfulPipeline) {
workflow =
testAllWorkflows.find(
wf => wf.status === 'completed' && wf.conclusion === 'success',
) ?? workflow;
}
artifacts = await _getArtifacts(workflow.id);
}
function downloadArtifact(