mirror of
https://github.com/actions/setup-java.git
synced 2025-06-30 21:04:16 +00:00
suggest users to run without daemon if fail to save Gradle cache on Windows
This commit is contained in:
parent
7fe6c4d631
commit
fae2927552
3 changed files with 51 additions and 0 deletions
19
src/cache.ts
19
src/cache.ts
|
@ -110,7 +110,26 @@ export async function save(id: string) {
|
|||
if (error.name === cache.ReserveCacheError.name) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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: PackageManager, error: Error) {
|
||||
if (packageManager.id !== 'gradle' || process.env['RUNNER_OS'] !== 'Windows') {
|
||||
return false;
|
||||
}
|
||||
const message = error.message || '';
|
||||
return message.startsWith('Tar failed with error: ');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue