10000 Cache hit output by dhvcc · Pull Request #373 · actions/setup-python · GitHub
[go: up one dir, main page]

Skip to content

Cache hit output #373

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

Merged
merged 6 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Build action with cache-hit output
  • Loading branch information
dhvcc committed Apr 4, 2022
commit fa50ad538807f67c405fa3aa67683425a2488d4d
19 changes: 12 additions & 7 deletions dist/cache-save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37234,15 +37234,20 @@ class CacheDistributor {
core.saveState(State.CACHE_PATHS, cachePath);
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
if (matchedKey) {
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
core.info(`Cache restored from key: ${matchedKey}`);
}
else {
core.info(`${this.packageManager} cache is not found`);
}
this.handleMatchResult(matchedKey);
});
}
handleMatchResult(matchedKey) {
if (matchedKey) {
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
core.info(`Cache restored from key: ${matchedKey}`);
}
else {
core.info(`${this.packageManager} cache is not found`);
}
core.info('cache was hit');
core.setOutput('cache-hit', Boolean(matchedKey));
}
}
exports.default = CacheDistributor;

Expand Down
19 changes: 12 additions & 7 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42579,15 +42579,20 @@ class CacheDistributor {
core.saveState(State.CACHE_PATHS, cachePath);
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
if (matchedKey) {
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
core.info(`Cache restored from key: ${matchedKey}`);
}
else {
core.info(`${this.packageManager} cache is not found`);
}
this.handleMatchResult(matchedKey);
});
}
handleMatchResult(matchedKey) {
if (matchedKey) {
core.saveState(State.CACHE_MATCHED_KEY, matchedKey);
core.info(`Cache restored from key: ${matchedKey}`);
}
else {
core.info(`${this.packageManager} cache is not found`);
}
core.info('cache was hit');
core.setOutput('cache-hit', Boolean(matchedKey));
}
}
exports.default = CacheDistributor;

Expand Down
1 change: 1 addition & 0 deletions src/cache-distributions/cache-distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ abstract class CacheDistributor {
} else {
core.info(`${this.packageManager} cache is not found`);
}
core.info('cache was hit');
core.setOutput('cache-hit', Boolean(matchedKey));
}
}
Expand Down
0