Disable automatic cache saves for merge queues (#1056)

Amp-Thread-ID:
https://ampcode.com/threads/T-01a0af68-f950-77dc-b9ae-9402987584c8

Closes: #1052

Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Kevin Stillhammer
2026-09-17 15:56:38 +02:00
committed by GitHub
parent 3377a30666
commit a761a4e9af
8 changed files with 95 additions and 10 deletions
+13 -1
View File
@@ -60,7 +60,7 @@ export function loadInputs(): SetupInputs {
const checksum = core.getInput("checksum");
const enableCache = getEnableCache();
const restoreCache = core.getInput("restore-cache") === "true";
const saveCache = core.getInput("save-cache") === "true";
const saveCache = getSaveCache();
const cacheSuffix = core.getInput("cache-suffix") || "";
const cacheLocalPath = getCacheLocalPath(
workingDirectory,
@@ -189,6 +189,18 @@ function getEnableCache(): boolean {
return enableCacheInput === "true";
}
function getSaveCache(): boolean {
const saveCacheInput = core.getInput("save-cache");
if (saveCacheInput === "auto") {
if (process.env.GITHUB_EVENT_NAME === "merge_group") {
log.info("Cache saving is disabled for the merge_group event");
return false;
}
return true;
}
return saveCacheInput === "true";
}
function getToolBinDir(workingDirectory: string): string | undefined {
const toolBinDirInput = core.getInput("tool-bin-dir");
if (toolBinDirInput !== "") {