Skip to content

Get reliable base ref for push-triggered "Compare Performance" workflow #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/compare-performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ jobs:
steps:
# Repo is required to get the previous tag ref that is the base of the comparison on tag push triggered run.
- name: Checkout repository
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: github.event_name == 'push'
uses: actions/checkout@v2
with:
# Parent commit is needed for determining the base ref on commit push trigg.
fetch-depth: 2

- name: Determine comparison ref
id: base-ref
Expand All @@ -60,7 +63,7 @@ jobs:
head -1
)"
else
COMPARISON_REF="${{ github.event.before }}"
COMPARISON_REF="$(git rev-parse ${{ github.sha }}^)"
fi

if [[ "$COMPARISON_REF" == "" ]]; then
Expand Down