mirror of
https://github.com/pre-commit/action.git
synced 2025-11-07 10:46:56 +00:00
Wrapped saving pre-commit cache to cache, in a try catch block
This commit is contained in:
parent
0404b96964
commit
d1027a948b
1 changed files with 14 additions and 1 deletions
15
index.js
15
index.js
|
|
@ -54,7 +54,20 @@ async function main() {
|
||||||
const restored = await cache.restoreCache(cachePaths, cacheKey);
|
const restored = await cache.restoreCache(cachePaths, cacheKey);
|
||||||
const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push});
|
const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push});
|
||||||
if (!restored) {
|
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) {
|
if (ret && push) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue