From cb3493c6130ed90da6ff230c5d3a77e1c849dbe5 Mon Sep 17 00:00:00 2001 From: Prajjwal Date: Thu, 20 Jun 2024 12:08:34 +0530 Subject: [PATCH] adds base and default ref for PR case --- packages/warp-cache/package.json | 2 +- packages/warp-cache/src/internal/cacheHttpClient.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/warp-cache/package.json b/packages/warp-cache/package.json index b1d0e9e4..7b27bae7 100644 --- a/packages/warp-cache/package.json +++ b/packages/warp-cache/package.json @@ -1,6 +1,6 @@ { "name": "github-actions.warp-cache", - "version": "1.2.0", + "version": "1.2.1", "preview": true, "description": "Github action to use WarpBuild's in-house cache offering", "keywords": [ diff --git a/packages/warp-cache/src/internal/cacheHttpClient.ts b/packages/warp-cache/src/internal/cacheHttpClient.ts index 818715a6..482e7c0e 100644 --- a/packages/warp-cache/src/internal/cacheHttpClient.ts +++ b/packages/warp-cache/src/internal/cacheHttpClient.ts @@ -156,9 +156,18 @@ export async function getCacheEntry( case 'pull_request': { const pullPayload = github.context.payload as PullRequestEvent + // Adds PR head branch and base branch to restoreBranches restoreBranches.push( `refs/heads/${pullPayload?.pull_request?.head?.ref}` ) + restoreBranches.push( + `refs/heads/${pullPayload?.pull_request?.base?.ref}` + ) + + // Adds default branch to restoreBranches + restoreBranches.push( + `refs/heads/${pullPayload?.repository?.default_branch}` + ) // If head points to a different repository, add it to restoreRepos. We allow restores from head repos as well. if (