From 563d99330348659158854544f957da59d3b6051d Mon Sep 17 00:00:00 2001 From: aleferreiranogueira Date: Thu, 16 Sep 2021 17:42:25 -0300 Subject: [PATCH 1/2] feat(get): set output if cache was succesfully oploaded --- .github/workflows/test.yml | 4 ++++ action.yml | 8 ++++++++ check-cache-hit.sh | 7 +++++++ 3 files changed, 19 insertions(+) create mode 100644 check-cache-hit.sh 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..d33978e --- /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 From b0e1793902562cffb50397c2d37ebe3886f75f04 Mon Sep 17 00:00:00 2001 From: aleferreiranogueira Date: Thu, 16 Sep 2021 17:54:19 -0300 Subject: [PATCH 2/2] feat(get): set output if cache was succesfully oploaded --- check-cache-hit.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check-cache-hit.sh b/check-cache-hit.sh index d33978e..41e6c19 100644 --- a/check-cache-hit.sh +++ b/check-cache-hit.sh @@ -1,7 +1,7 @@ #!/bin/bash FILE=$1 if [ -f "$FILE" ]; then - echo true + echo "true" else - echo false + echo "false" fi \ No newline at end of file