Skip to content

Commit

Permalink
.github: Fix chart push on forks
Browse files Browse the repository at this point in the history
Checkout the SHA instead of the ref on forks, since the ref will only
exist on the fork, not the upstream repository being checked out.

Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
  • Loading branch information
chancez authored and sayboras committed May 5, 2023
1 parent 1c53367 commit 849bd73
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/push-chart-ci.yaml
Expand Up @@ -48,7 +48,12 @@ jobs:
echo ref="${{ inputs.checkout_ref }}" >> $GITHUB_OUTPUT
echo sha="${{ inputs.checkout_ref }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "workflow_run" ]]; then
echo ref="${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT
if [[ "${{ github.event.workflow_run.head_repository.fork }}" == "true" ]]; then
# use the SHA on forks since the head_branch won't exist in the upstream repository
echo ref="${{ github.event.workflow_run.head_sha }}" >> $GITHUB_OUTPUT
else
echo ref="${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT
fi
echo sha="${{ github.event.workflow_run.head_sha }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "push" ]]; then
echo ref="${{ github.ref }}" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 849bd73

Please sign in to comment.