From cd15dc00c618c8175d8ff4d2472e0326716d25fa Mon Sep 17 00:00:00 2001 From: George Reith Date: Thu, 5 Sep 2024 17:52:32 +0100 Subject: [PATCH 1/2] fix: check out correct branch on pull_request events --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 588b6e1..15cd328 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -229,8 +229,8 @@ push_to_branch() { git config --global user.email "${INPUT_GITHUB_USER_EMAIL}" git config --global user.name "${INPUT_GITHUB_USER_NAME}" - if [ "$INPUT_SKIP_REF_CHECKOUT" != true ] && [ ${GITHUB_REF#refs/heads/} != $GITHUB_REF ]; then - git checkout "${GITHUB_REF#refs/heads/}" + if [ "$INPUT_SKIP_REF_CHECKOUT" != true ]; then + git checkout "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" fi if [ -n "$(git show-ref refs/heads/${BRANCH})" ]; then From 886f50a3ef3e7f147e6b206f6acf8e6c822952a8 Mon Sep 17 00:00:00 2001 From: George Reith Date: Thu, 5 Sep 2024 18:05:54 +0100 Subject: [PATCH 2/2] fix: work with tags event --- entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 15cd328..d02ead8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -230,7 +230,10 @@ push_to_branch() { git config --global user.name "${INPUT_GITHUB_USER_NAME}" if [ "$INPUT_SKIP_REF_CHECKOUT" != true ]; then - git checkout "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" + CHECKOUT=${GITHUB_HEAD_REF:-${GITHUB_REF}} + CHECKOUT=${CHECKOUT#refs/heads/} + CHECKOUT=${CHECKOUT#refs/tags/} + git checkout "${CHECKOUT}" fi if [ -n "$(git show-ref refs/heads/${BRANCH})" ]; then