Skip to content

Commit 1cdc5a1

Browse files
committed
Checkout github.head_ref and repo for PRs
actions/checkout#27 (comment) actions/checkout#1108
1 parent 730f3fd commit 1cdc5a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,16 @@ runs:
104104
# Set repo and ref from which to run Docker container action
105105
# to handle cases in which `github.action_` context is not set
106106
# https://github.com/actions/runner/issues/2473
107-
REF=${{ env.ACTION_REF || github.ref_name }}
108-
REPO=${{ env.ACTION_REPO || github.repository }}
107+
REF=${{ env.ACTION_REF || env.PR_REF || github.ref_name }}
108+
REPO=${{ env.ACTION_REPO || env.PR_REPO || github.repository }}
109109
echo "ref=$REF" >>"$GITHUB_OUTPUT"
110110
echo "repo=$REPO" >>"$GITHUB_OUTPUT"
111111
shell: bash
112112
env:
113113
ACTION_REF: ${{ github.action_ref }}
114114
ACTION_REPO: ${{ github.action_repository }}
115+
PR_REF: ${{ github.event.pull_request.head.ref }}
116+
PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
115117
- name: Check out action repo
116118
uses: actions/checkout@v4
117119
with:

0 commit comments

Comments
 (0)