mirror of
https://github.com/actions/setup-java
synced 2024-11-23 17:52:02 +00:00
Set output cache-hit
to indicate if cache was hit (#275)
This commit is contained in:
parent
0aa6f2a84f
commit
d2e3f417a9
4 changed files with 8 additions and 0 deletions
|
@ -70,6 +70,8 @@ The action has a built-in functionality for caching and restoring dependencies.
|
||||||
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`
|
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`
|
||||||
- maven: `**/pom.xml`
|
- maven: `**/pom.xml`
|
||||||
|
|
||||||
|
The workflow output `cache-hit` is set to indicate if an exact match was found for the key [as actions/cache does](https://github.com/actions/cache/tree/main#outputs).
|
||||||
|
|
||||||
The cache input is optional, and caching is turned off by default.
|
The cache input is optional, and caching is turned off by default.
|
||||||
|
|
||||||
#### Caching gradle dependencies
|
#### Caching gradle dependencies
|
||||||
|
|
2
dist/cleanup/index.js
vendored
2
dist/cleanup/index.js
vendored
|
@ -61925,9 +61925,11 @@ function restore(id) {
|
||||||
]);
|
]);
|
||||||
if (matchedKey) {
|
if (matchedKey) {
|
||||||
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
||||||
|
core.setOutput('cache-hit', matchedKey === primaryKey);
|
||||||
core.info(`Cache restored from key: ${matchedKey}`);
|
core.info(`Cache restored from key: ${matchedKey}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
core.setOutput('cache-hit', false);
|
||||||
core.info(`${packageManager.id} cache is not found`);
|
core.info(`${packageManager.id} cache is not found`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
2
dist/setup/index.js
vendored
2
dist/setup/index.js
vendored
|
@ -18662,9 +18662,11 @@ function restore(id) {
|
||||||
]);
|
]);
|
||||||
if (matchedKey) {
|
if (matchedKey) {
|
||||||
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
||||||
|
core.setOutput('cache-hit', matchedKey === primaryKey);
|
||||||
core.info(`Cache restored from key: ${matchedKey}`);
|
core.info(`Cache restored from key: ${matchedKey}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
core.setOutput('cache-hit', false);
|
||||||
core.info(`${packageManager.id} cache is not found`);
|
core.info(`${packageManager.id} cache is not found`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -77,8 +77,10 @@ export async function restore(id: string) {
|
||||||
]);
|
]);
|
||||||
if (matchedKey) {
|
if (matchedKey) {
|
||||||
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
||||||
|
core.setOutput('cache-hit', matchedKey === primaryKey);
|
||||||
core.info(`Cache restored from key: ${matchedKey}`);
|
core.info(`Cache restored from key: ${matchedKey}`);
|
||||||
} else {
|
} else {
|
||||||
|
core.setOutput('cache-hit', false);
|
||||||
core.info(`${packageManager.id} cache is not found`);
|
core.info(`${packageManager.id} cache is not found`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue