Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
Fix gitref logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fheinecke committed Feb 16, 2024
1 parent 1b7a0eb commit 247a3e7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/tag-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,22 @@ jobs:
env:
REF_VALUE: ${{ inputs.artifact-tag || github.head_ref || github.ref }}
run: |
# If value is a tag
if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ] || [ "$GITHUB_REF_TYPE" == "tag" ]; then
# If a workflow dispatche triggered the run
if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then
# REF_VALUE = inputs.artifact-tag, tag name
echo "gitref=refs/tags/$REF_VALUE" >> "$GITHUB_OUTPUT"
exit 0
fi
# If a push triggered the run
if [ "$GITHUB_EVENT_NAME" == "push" ]; then
# REF_VALUE = github.ref (fully formed)
echo "gitref=$REF_VALUE" >> "$GITHUB_OUTPUT"
exit 0
fi
# Otherwise, ref must be a branch
# REF_VALUE = github.head_ref, branch name
echo "gitref=refs/heads/$REF_VALUE" >> "$GITHUB_OUTPUT"
- name: Checkout repo
uses: actions/checkout@v4
Expand Down

0 comments on commit 247a3e7

Please sign in to comment.