Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
do not save the cache if it was restored
  • Loading branch information
asottile committed Jun 13, 2020
1 parent 5c843d9 commit aea23c4fca0ad715720d870273f6b7bed1f5376b
Showing 1 changed file with 4 additions and 2 deletions.
@@ -51,9 +51,11 @@ async function main() {
const cachePaths = [path.join(os.homedir(), '.cache', 'pre-commit')];
const py = getPythonVersion();
const cacheKey = `pre-commit-2-${hashString(py)}-${hashFile('.pre-commit-config.yaml')}`;
await cache.restoreCache(cachePaths, cacheKey);
const restored = await cache.restoreCache(cachePaths, cacheKey);
const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push});
await cache.saveCache(cachePaths, cacheKey);
if (!restored) {
await cache.saveCache(cachePaths, cacheKey);
}

if (ret && push) {
// actions do not run on pushes made by actions.

0 comments on commit aea23c4

Please sign in to comment.