Skip to content

Commit ff20433

Browse files
authored
Merge pull request #85 from puppetlabs/maint-update_checkout_ref_gem_ci
(CAT-1829) - Update to dynamic checkout ref gem_ci
2 parents ecb6a90 + 27ef930 commit ff20433

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/gem_ci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,22 @@ jobs:
3434
PUPPET_GEM_VERSION: ${{ inputs.puppet_gem_version }}
3535

3636
steps:
37+
# If we are on a PR, checkout the PR head sha, else checkout the default branch
38+
# required when trigger set to pull_request_target
39+
- name: "Set the checkout ref"
40+
id: set_ref
41+
run: |
42+
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
43+
echo "ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
44+
else
45+
echo "ref=${{ github.ref }}" >> $GITHUB_OUTPUT
46+
fi
3747
3848
- name: "checkout"
3949
uses: "actions/checkout@v4"
50+
with:
51+
fetch-depth: 1
52+
ref: ${{ steps.set_ref.outputs.ref }}
4053

4154
- name: "export environment"
4255
run: |

0 commit comments

Comments
 (0)