Skip to content

Commit

Permalink
Merge branch 'main' into update-types/node16-to-20-and-v3-in-readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardkaindl authored Jul 31, 2024
2 parents 6a799cc + 40c3b67 commit cbf0ae6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __tests__/restore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ test("Fail restore when fail on cache miss is enabled and primary + restore keys
);

expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(0);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);

expect(failedMock).toHaveBeenCalledWith(
`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${key}`
Expand Down
3 changes: 2 additions & 1 deletion __tests__/restoreOnly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ test("restore with no cache found", async () => {
);

expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
expect(outputMock).toHaveBeenCalledTimes(1);
expect(outputMock).toHaveBeenCalledWith("cache-hit", "false");
expect(outputMock).toHaveBeenCalledTimes(2);
expect(failedMock).toHaveBeenCalledTimes(0);

expect(infoMock).toHaveBeenCalledWith(
Expand Down
1 change: 1 addition & 0 deletions dist/restore-only/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59415,6 +59415,7 @@ function restoreImpl(stateProvider, earlyExit) {
const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
if (!cacheKey) {
core.setOutput(constants_1.Outputs.CacheHit, false.toString());
if (failOnCacheMiss) {
throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);
}
Expand Down
1 change: 1 addition & 0 deletions dist/restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59415,6 +59415,7 @@ function restoreImpl(stateProvider, earlyExit) {
const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive);
if (!cacheKey) {
core.setOutput(constants_1.Outputs.CacheHit, false.toString());
if (failOnCacheMiss) {
throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);
}
Expand Down
1 change: 1 addition & 0 deletions examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ jobs:
```yaml
- name: Get pip cache dir
id: pip-cache
shell: bash
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion src/restoreImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export async function restoreImpl(
);

if (!cacheKey) {
core.setOutput(Outputs.CacheHit, false.toString());
if (failOnCacheMiss) {
throw new Error(
`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`
Expand All @@ -62,7 +63,6 @@ export async function restoreImpl(
...restoreKeys
].join(", ")}`
);

return;
}

Expand Down

0 comments on commit cbf0ae6

Please sign in to comment.