mirror of
https://github.com/pre-commit/action.git
synced 2025-11-07 02:36:55 +00:00
do not save the cache if it was restored
This commit is contained in:
parent
5c843d930a
commit
aea23c4fca
1 changed files with 4 additions and 2 deletions
6
index.js
6
index.js
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue