Skip to content
Closed
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Create a workflow `.yml` file in your repositories `.github/workflows` directory
* `key` - An explicit key for restoring and saving the cache
* `restore-keys` - An ordered list of keys to use for restoring the cache if no cache hit occurred for key

### Environment Variables
* `CACHE_SKIP_SAVE` - [optional] When set to `true`, any modifications made to the restored cache will not be persisted back at the end of the step. This environment variable can be set at any time using `echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV`

### Outputs

* `cache-hit` - A boolean value to indicate an exact match was found for the key
Expand All @@ -67,6 +70,8 @@ jobs:
- uses: actions/checkout@v2

- name: Cache Primes
env:
CACHE_SKIP_SAVE: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is the default example and skipping cache save is a special case, I wouldn't include this here. Perhaps move this into the Examples.md file and we can add some specific examples of where this is useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something we can also highlight in the example is how users can either set this on the cache step as shown here or using echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes you've suggested on the readme file capture it well enough

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roni-frantchi & @dhadka, would be great if this PR could be merged to reduce the workflow runtime when a cache-update isn't required. Seems like only a small adjustment would be needed?
Not sure if this issue could be addressed in this PR too: skipping the post-step altogether when there was a cache-hit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this issue could be addressed in this PR too

I'm not sure that it can either...
Seeing so many are expecting it, maybe we should explore doing it on another PR?..

Seems like only a small adjustment would be needed?

Sorry @rene-leanix it's been a while - what adjustment would that be?..

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roni-frantchi, I was just referring to @dhadka's comments above in this thread: here and here.

id: cache-primes
uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ runs:
using: 'node12'
main: 'dist/restore/index.js'
post: 'dist/save/index.js'
post-if: 'success()'
post-if: success() && env.CACHE_SKIP_SAVE != 'true'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only suggestion would be to have a more specific environment variable here.

Something like GH_ACTIONS_CACHE_SKIP_SAVE

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roni-frantchi, would you be able to pick this up? Would be great to get this merged!

branding:
icon: 'archive'
color: 'gray-dark'