Skip to content

Commit c62bc12

Browse files
authored
Merge pull request #91 from per1234/fix-compare-performance-push-base
Get reliable base ref for push-triggered "Compare Performance" workflow
2 parents 53e02d4 + 3022f03 commit c62bc12

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/compare-performance.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ jobs:
3636
steps:
3737
# Repo is required to get the previous tag ref that is the base of the comparison on tag push triggered run.
3838
- name: Checkout repository
39-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
39+
if: github.event_name == 'push'
4040
uses: actions/checkout@v2
41+
with:
42+
# Parent commit is needed for determining the base ref on commit push trigg.
43+
fetch-depth: 2
4144

4245
- name: Determine comparison ref
4346
id: base-ref
@@ -60,7 +63,7 @@ jobs:
6063
head -1
6164
)"
6265
else
63-
COMPARISON_REF="${{ github.event.before }}"
66+
COMPARISON_REF="$(git rev-parse ${{ github.sha }}^)"
6467
fi
6568
6669
if [[ "$COMPARISON_REF" == "" ]]; then

0 commit comments

Comments
 (0)