Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(get): set output if cache was succesfully uploaded #23

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
run: rm -rf temp

- name: Get cache
id: get-cache
uses: ./
with:
action: get
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
7 changes: 7 additions & 0 deletions check-cache-hit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
FILE=$1
if [ -f "$FILE" ]; then
echo "true"
else
echo "false"
fi