Skip to content
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

Fix Action fails if saving cache fails #53 #54

Merged
merged 1 commit into from Apr 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion index.js
Expand Up @@ -54,7 +54,20 @@ async function main() {
const restored = await cache.restoreCache(cachePaths, cacheKey);
const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push});
if (!restored) {
await cache.saveCache(cachePaths, cacheKey);
try {
await cache.saveCache(cachePaths, cacheKey);
} catch (e) {
core.warning(
`There was an error saving the pre-commit environments to cache:

${e.message || e}

This only has performance implications and won't change the result of your pre-commit tests.
If this problem persists on your default branch, you can try to fix it by editing your '.pre-commit-config.yaml'.
For example try to run 'pre-commit autoupdate' or simply add a blank line.
This will result in a different hash value and thus a different cache target.`.replace(/^ +/gm, '')
);
}
}

if (ret && push) {
Expand Down