From b192fe56755581d8c69940cc8b7fb9fd9fdb9134 Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Fri, 9 Feb 2024 09:24:10 +0100 Subject: [PATCH] chore(action): properly load correct git version to be used to download images. Signed-off-by: Federico Di Pierro --- action.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 63287f1..3b8a824 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,22 @@ outputs: runs: using: "composite" steps: + # If action_ref points to v0 or v0.3, expect to be on a tag, + # else expect that user passed either `main` or an hash. + - name: Fetch tag or hash to be used + shell: bash + working-directory: ${{ github.action_path }} + id: git + run: | + if [[ "$ACTION_REF" =~ ^v[0-9] ]]; then + GIT_VER=$(git tag --points-at HEAD) + else + GIT_VER=$ACTION_REF + fi + echo "git_ver=$GIT_VER" >> $GITHUB_OUTPUT + env: + ACTION_REF: ${{ github.action_ref }} + - name: Generate vars yaml working-directory: ${{ github.action_path }}/ansible-playbooks shell: bash @@ -33,13 +49,11 @@ runs: cat > vars.yml <