mirror of
https://github.com/pre-commit/action.git
synced 2026-09-03 20:21:40 +00:00
do not save the cache if it was restored
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user