From a5b5d5863258f93c073a742f186c3a07b021c7fa Mon Sep 17 00:00:00 2001 From: Jules Date: Wed, 7 Sep 2022 10:38:37 +0100 Subject: [PATCH] Merge pull request #10856 from Expensify/Rory-FixGetPRDetails [No QA] Fetch full PR object to fix CPs (cherry picked from commit 7747acd1591ef783044bc6d8c2bf911040f47a8e) --- .../getPullRequestDetails/getPullRequestDetails.js | 10 +++++++--- .../actions/javascript/getPullRequestDetails/index.js | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.js b/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.js index cf3f27ee662c..15ee2869a14d 100644 --- a/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.js +++ b/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.js @@ -87,9 +87,13 @@ if (pullRequestNumber) { ...DEFAULT_PAYLOAD, state: 'all', }) + .then(({data}) => _.find(data, PR => PR.user.login === user && titleRegex.test(PR.title)).number) + .then(matchingPRNum => GithubUtils.octokit.pulls.get({ + ...DEFAULT_PAYLOAD, + pull_number: matchingPRNum, + })) .then(({data}) => { - const matchingPR = _.find(data, PR => PR.user.login === user && titleRegex.test(PR.title)); - outputMergeCommitHash(matchingPR); - outputMergeActor(matchingPR); + outputMergeCommitHash(data); + outputMergeActor(data); }); } diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 692751956bbf..b06196149058 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -97,10 +97,14 @@ if (pullRequestNumber) { ...DEFAULT_PAYLOAD, state: 'all', }) + .then(({data}) => _.find(data, PR => PR.user.login === user && titleRegex.test(PR.title)).number) + .then(matchingPRNum => GithubUtils.octokit.pulls.get({ + ...DEFAULT_PAYLOAD, + pull_number: matchingPRNum, + })) .then(({data}) => { - const matchingPR = _.find(data, PR => PR.user.login === user && titleRegex.test(PR.title)); - outputMergeCommitHash(matchingPR); - outputMergeActor(matchingPR); + outputMergeCommitHash(data); + outputMergeActor(data); }); }