From f24f0028d3664da790acc5d28a057e2014b0d141 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Tue, 9 Jul 2024 15:55:51 +0200 Subject: [PATCH] fix action --- project/sync-and-cache/action.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/project/sync-and-cache/action.yml b/project/sync-and-cache/action.yml index c852fef..a152917 100644 --- a/project/sync-and-cache/action.yml +++ b/project/sync-and-cache/action.yml @@ -46,7 +46,6 @@ runs: resources_detected=$(yq e '.info | has("test_resources")' "${{ inputs.project_config }}") if [ "$resources_detected" == "false" ]; then echo "No test resources detected." - echo "cache_key=" >> $GITHUB_OUTPUT echo "dest_paths=" >> $GITHUB_OUTPUT exit 0 fi @@ -78,8 +77,12 @@ runs: - name: Create hash key shell: bash id: cache_key - if: ${{ steps.test_resources.outputs.cache_key != '' }} run: | + if [ -z "${{ steps.test_resources.outputs.test_resources }}" ]; then + echo "cache_key=" >> $GITHUB_OUTPUT + exit 0 + fi + function hash_s3() { local s3_path="$1" AWS_EC2_METADATA_DISABLED=true \ @@ -111,7 +114,7 @@ runs: - name: Print resources shell: bash - if: ${{ steps.test_resources.outputs.cache_key != '' }} + if: ${{ steps.cache_key.outputs.cache_key != '' }} run: | echo "### Cache key: ${{ steps.cache_key.outputs.cache_key }}" echo @@ -129,7 +132,7 @@ runs: # initialize cache - name: Cache resources uses: actions/cache@v4 - if: ${{ steps.test_resources.outputs.cache_key != '' }} + if: ${{ steps.cache_key.outputs.cache_key != '' }} with: path: ${{ steps.test_resources.outputs.dest_paths }} key: ${{ steps.cache_key.outputs.cache_key }} @@ -138,7 +141,7 @@ runs: # sync if need be - name: Sync resources shell: bash - if: ${{ steps.test_resources.outputs.cache_key != '' }} + if: ${{ steps.cache_key.outputs.cache_key != '' }} run: | function sync_s3() { local s3_path="$1" @@ -150,7 +153,7 @@ runs: --no-sign-request } - echo "${{ steps.test_resources.outputs.test_resources }}" | \ + echo "${{ steps.cache_key.outputs.test_resources }}" | \ while read -r line; do type=$(echo "$line" | yq e '.type') path=$(echo "$line" | yq e '.path') @@ -165,7 +168,7 @@ runs: - name: List resources shell: bash - if: ${{ steps.test_resources.outputs.cache_key != '' }} + if: ${{ steps.cache_key.outputs.cache_key != '' }} run: | echo "${{ steps.test_resources.outputs.test_resources }}" | \ while read -r line; do