Skip to content
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ To restore from the cache only:
node_modules
```

To restore from the cache only (dynamically):

```yaml
- uses: tespkg/actions-cache@v1
with:
accessKey: "Q3AM3UQ867SPQQA43P2F" # required
secretKey: "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG" # required
bucket: actions-cache # required
restore-only: true
# actions/cache compatible properties: https://github.com/actions/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: |
node_modules
```

To check if cache hits and size is not zero without downloading:

```yaml
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ inputs:
description: "Check if a restore is successfull but dont download/extract cache."
required: false
default: "false"
restore-only:
description: "Restore a cache but don't attempt to save it"
required: false
default: "false"
retry:
description: "Enable retry on failure for S3 operations"
required: false
Expand Down
7 changes: 6 additions & 1 deletion src/save.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import * as core from "@actions/core";
import {
getInputAsBoolean,
saveCache,
} from "./utils";

process.on("uncaughtException", (e) => core.info("warning: " + e.message));

saveCache(false);
const restoreOnly = getInputAsBoolean("restore-only");

if (!restoreOnly) {
saveCache(false);
}