Skip to content

Commit

Permalink
Merge pull request #5 from reecetech/DE-5249-compat-with-pulls
Browse files Browse the repository at this point in the history
Add compatibility with pull request events
  • Loading branch information
ps-jay authored May 26, 2022
2 parents 1c9ba64 + 3f9f14d commit d8aa5a6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,18 @@ runs:
shell: bash
run: |
set -euo pipefail
git checkout --progress --force -B "${{ github.ref_name }}" "${{ github.ref }}"
# Compatibility with pull request triggers
if [[ -n "${{ github.head_ref }}" ]] ; then
export ref="refs/heads/${{ github.head_ref }}"
export ref_name="${{ github.head_ref }}"
else
export ref="${{ github.ref }}"
export ref_name="${{ github.ref_name }}"
fi
if [[ "${{ github.ref_type }}" == 'tag' ]] ; then
git checkout --progress --force "${ref}"
else
git checkout --progress --force -B "${ref_name}" "${ref}"
fi

0 comments on commit d8aa5a6

Please sign in to comment.