From 1ee5a6cee54df82068385bdfb6dc0a1d311e4843 Mon Sep 17 00:00:00 2001 From: Judson Lester Date: Wed, 19 Oct 2022 12:47:05 -0700 Subject: [PATCH] Create the branch only if needed --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 1527412..25f05ee 100644 --- a/action.yml +++ b/action.yml @@ -140,6 +140,7 @@ runs: git fetch origin $DESTINATION_BRANCH else export BASE=$(gh repo view --json defaultBranchRef --template '{{ .defaultBranchRef.name }}' ${{github.repository}}) + export BASE_SHA=$( git rev-parse origin/$BASE ) gh api --method POST /repos/:owner/:repo/git/refs \ --field ref=refs/heads/$DESTINATION_BRANCH \ --field sha=$BASE_SHA