From 247a3e7a95ad17c2c8bc77551df94f0e8f839ab1 Mon Sep 17 00:00:00 2001 From: Fred Heinecke Date: Thu, 15 Feb 2024 20:28:18 -0600 Subject: [PATCH] Fix gitref logic --- .github/workflows/tag-build.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tag-build.yaml b/.github/workflows/tag-build.yaml index f3b54dc9a..ae13d1d2a 100644 --- a/.github/workflows/tag-build.yaml +++ b/.github/workflows/tag-build.yaml @@ -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