From e91de73442890a712d1aa9cee5f6c096404d01f0 Mon Sep 17 00:00:00 2001 From: Chris Berg Date: Tue, 19 Nov 2024 09:33:36 -0800 Subject: [PATCH 1/2] fix: sort the list of merges by reverse timestamp to ensure the most rescent merge is pulled --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index b393b62..57fa037 100644 --- a/action.yml +++ b/action.yml @@ -53,8 +53,8 @@ runs: pr=$(\ curl -sL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ inputs.token }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/search/issues\?q\=repo:${{ github.repository }}+is:pr+is:merged \ - | jq .items[0].number + https://api.github.com/search/issues\?q\=repo:bcgov/onroutebc+is:pr+is:merged \ + | jq '.items | sort_by(.pull_request.merged_at) | reverse'[0].number ) if [ -z "${pr}" ] From e79917ed796b19b9d28d4d63767877ae23069a25 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 19 Nov 2024 10:08:18 -0800 Subject: [PATCH 2/2] Use var --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 57fa037..a0c330c 100644 --- a/action.yml +++ b/action.yml @@ -53,7 +53,7 @@ runs: pr=$(\ curl -sL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ inputs.token }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/search/issues\?q\=repo:bcgov/onroutebc+is:pr+is:merged \ + https://api.github.com/search/issues\?q\=repo:${{ github.repository }}+is:pr+is:merged \ | jq '.items | sort_by(.pull_request.merged_at) | reverse'[0].number )