From f5595c716b33303f8cccf6ba433e281c86ee14b7 Mon Sep 17 00:00:00 2001 From: Blake Friedman Date: Tue, 29 Oct 2024 10:08:07 -0700 Subject: [PATCH] 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 --- .../release-testing/utils/github-actions-utils.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/release-testing/utils/github-actions-utils.js b/scripts/release-testing/utils/github-actions-utils.js index 99498af8cc8..fc3145ca378 100644 --- a/scripts/release-testing/utils/github-actions-utils.js +++ b/scripts/release-testing/utils/github-actions-utils.js @@ -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(