Skip to content

Commit a869dd3

Browse files
committed
Checkout github.head_ref and repo for PRs
actions/checkout#27 (comment) actions/checkout#1108
1 parent 5ded531 commit a869dd3

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
@@ -111,14 +111,16 @@ runs:
111111
# Set repo and ref from which to run Docker container action
112112
# to handle cases in which `github.action_` context is not set
113113
# https://github.com/actions/runner/issues/2473
114-
REF=${{ env.ACTION_REF || github.ref_name }}
115-
REPO=${{ env.ACTION_REPO || github.repository }}
114+
REF=${{ env.ACTION_REF || env.PR_REF || github.ref_name }}
115+
REPO=${{ env.ACTION_REPO || env.PR_REPO || github.repository }}
116116
echo "ref=$REF" >>"$GITHUB_OUTPUT"
117117
echo "repo=$REPO" >>"$GITHUB_OUTPUT"
118118
shell: bash
119119
env:
120120
ACTION_REF: ${{ github.action_ref }}
121121
ACTION_REPO: ${{ github.action_repository }}
122+
PR_REF: ${{ github.event.pull_request.head.ref }}
123+
PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
122124
- name: Check out action repo
123125
uses: actions/checkout@v4
124126
with:

0 commit comments

Comments
 (0)