diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d2c8f6..55b02c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,6 +65,7 @@ jobs: run: rm -rf temp - name: Get cache + id: get-cache uses: ./ with: action: get @@ -74,6 +75,9 @@ jobs: bucket: ${{ secrets.AWS_BUCKET }} key: ${{ hashFiles('action.yml') }}-${{ matrix.os }} + - name: Print get cache output + run: echo ${{ steps.get-cache.outputs.cache-hit }} + - name: List cache folder shell: bash run: ls temp diff --git a/action.yml b/action.yml index b567558..1e35351 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,10 @@ inputs: description: "Specifies the desired Storage Class for the object." required: false default: STANDARD +outputs: + cache-hit: + description: "Wheter the cache was downloaded succesfully or not, only used when the action is GET" + value: ${{ steps.cache-hit.outputs.hit }} runs: using: "composite" steps: @@ -44,3 +48,7 @@ runs: KEY: ${{ inputs.key }} ARTIFACTS: ${{ inputs.artifacts }} OS: ${{ runner.os }} + + - id: cache-hit + run: echo "::set-output name=hit::$($GITHUB_ACTION_PATH/check-cache-hit.sh ${{ inputs.key }})" + shell: bash \ No newline at end of file diff --git a/check-cache-hit.sh b/check-cache-hit.sh new file mode 100644 index 0000000..41e6c19 --- /dev/null +++ b/check-cache-hit.sh @@ -0,0 +1,7 @@ +#!/bin/bash +FILE=$1 +if [ -f "$FILE" ]; then + echo "true" +else + echo "false" +fi \ No newline at end of file