From 19ab19d64af4fb81baab184a61dbd51cfc0cf5a1 Mon Sep 17 00:00:00 2001 From: rory Date: Thu, 9 Nov 2023 14:06:58 -0800 Subject: [PATCH] Trust the input tag and compare between the input tag and the last completed deploy --- .../getDeployPullRequestList/getDeployPullRequestList.js | 7 +------ .../actions/javascript/getDeployPullRequestList/index.js | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.js b/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.js index ad1668ecd597..a64ebfc240ba 100644 --- a/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.js +++ b/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.js @@ -23,12 +23,7 @@ async function run() { }) ).data.workflow_runs; - const inputTagIndex = _.findIndex(completedDeploys, (workflowRun) => workflowRun.head_branch === inputTag); - if (inputTagIndex < 0) { - throw new Error(`No completed deploy found for input tag ${inputTag}`); - } - - const priorTag = completedDeploys[inputTagIndex + 1].head_branch; + const priorTag = _.first(completedDeploys).head_branch; console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`); const prList = await GitUtils.getPullRequestsMergedBetween(priorTag, inputTag); console.log(`Found the pull request list: ${prList}`); diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index a795b2bab9a7..e97e5dbcb43a 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -32,12 +32,7 @@ async function run() { }) ).data.workflow_runs; - const inputTagIndex = _.findIndex(completedDeploys, (workflowRun) => workflowRun.head_branch === inputTag); - if (inputTagIndex < 0) { - throw new Error(`No completed deploy found for input tag ${inputTag}`); - } - - const priorTag = completedDeploys[inputTagIndex + 1].head_branch; + const priorTag = _.first(completedDeploys).head_branch; console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`); const prList = await GitUtils.getPullRequestsMergedBetween(priorTag, inputTag); console.log(`Found the pull request list: ${prList}`);