suggest users to run without daemon if fail to save Gradle cache on Windows

This commit is contained in:
Kengo TODA 2021-07-20 11:32:37 +08:00
parent 7fe6c4d631
commit fae2927552
3 changed files with 51 additions and 0 deletions

16
dist/cleanup/index.js vendored
View file

@ -64623,12 +64623,28 @@ function save(id) {
core.info(error.message);
}
else {
if (isProbablyGradleDaemonProblem(packageManager, error)) {
core.warning('Failed to save Gradle cache on Windows. If tar.exe reported "Permission denied", try to run Gradle with `--no-daemon` option. Refer to https://github.com/actions/cache/issues/454 for detail.');
}
throw error;
}
}
});
}
exports.save = save;
/**
* @param packageManager the specified package manager by user
* @param error the error thrown by the saveCache
* @returns true if the given error seems related to the {@link https://github.com/actions/cache/issues/454|running Gradle Daemon issue}.
* @see {@link https://github.com/actions/cache/issues/454#issuecomment-840493935|why --no-daemon is necessary}
*/
function isProbablyGradleDaemonProblem(packageManager, error) {
if (packageManager.id !== 'gradle' || process.env['RUNNER_OS'] !== 'Windows') {
return false;
}
const message = error.message || '';
return message.startsWith('Tar failed with error: ');
}
/***/ }),