Skip to content

Commit 2a8f96d

Browse files
authored
Merge pull request #87 from puppetlabs/maint-update_checkout_ref_gem_ci
(bug) - Fix broken conditional on windows
2 parents ff20433 + 2e3a3fb commit 2a8f96d

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

.github/workflows/gem_ci.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,13 @@ 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
47-
4837
- name: "checkout"
4938
uses: "actions/checkout@v4"
5039
with:
5140
fetch-depth: 1
52-
ref: ${{ steps.set_ref.outputs.ref }}
41+
# If we are on a PR, checkout the PR head sha, else checkout the default branch
42+
# required when trigger set to pull_request_target, ternary syntax is "${{ x && 'ifTrue' || 'ifFalse' }}"
43+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
5344

5445
- name: "export environment"
5546
run: |

0 commit comments

Comments
 (0)