Backport #1151: Fix missing wrapper cache distributions (#1153)

Skip optional Maven and Gradle wrapper cache saves when their distribution paths do not exist, while allowing the main dependency cache to save.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c0b19ff2-ef52-4ac1-a832-0f8f72c43219
This commit is contained in:
Bruno Borges
2026-07-28 21:46:39 -04:00
committed by GitHub
parent 6a3384db74
commit e498d2a66a
4 changed files with 82 additions and 9 deletions
+8
View File
@@ -50898,6 +50898,14 @@ function saveAdditionalCache(packageManager, additionalCache) {
core.info(`Cache hit occurred on the ${additionalCache.name} primary key ${primaryKey}, not saving cache.`);
return;
}
const globber = yield glob.create(additionalCache.path.join('\n'), {
implicitDescendants: false
});
const cachePaths = yield globber.glob();
if (cachePaths.length === 0) {
core.debug(`${additionalCache.name} cache paths do not exist, not saving cache.`);
return;
}
try {
const cacheId = yield cache.saveCache(additionalCache.path, primaryKey);
if (cacheId === -1) {