Add read-only dependency cache mode (#1169)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b3f6f152-8ac4-4c29-b04a-acac8e100777
This commit is contained in:
Bruno Borges
2026-07-29 10:20:14 -04:00
committed by GitHub
parent bcd3ba3d32
commit 62f345fa33
8 changed files with 138 additions and 4 deletions
+10 -2
View File
@@ -97338,6 +97338,7 @@ const MAVEN_GPG_PASSPHRASE_DEFAULT_ENV = 'MAVEN_GPG_PASSPHRASE';
const GPG_PASSPHRASE_PROFILE_ID = 'setup-java-gpg';
const INPUT_CACHE = 'cache';
const INPUT_CACHE_DEPENDENCY_PATH = 'cache-dependency-path';
const INPUT_CACHE_READ_ONLY = 'cache-read-only';
const INPUT_JOB_STATUS = 'job-status';
const STATE_GPG_PRIVATE_KEY_FINGERPRINT = 'gpg-private-key-fingerprint';
const M2_DIR = '.m2';
@@ -97365,7 +97366,7 @@ function getTempDir() {
return tempDirectory;
}
function util_getBooleanInput(inputName, defaultValue = false) {
const inputValue = core.getInput(inputName);
const inputValue = getInput(inputName);
const normalizedValue = inputValue.trim().toLowerCase();
if (!normalizedValue) {
return defaultValue;
@@ -98076,7 +98077,14 @@ async function removePrivateKeyFromKeychain() {
async function cleanup_java_saveCache() {
const jobStatus = isJobStatusSuccess();
const cache = getInput(INPUT_CACHE);
return jobStatus && cache ? save(cache) : Promise.resolve();
if (!jobStatus || !cache) {
return;
}
if (util_getBooleanInput(INPUT_CACHE_READ_ONLY, false)) {
info('Cache saving is skipped because cache-read-only is enabled.');
return;
}
await save(cache);
}
/**
* The save process is best-effort, and it should not make the workflow fail
+1
View File
@@ -72120,6 +72120,7 @@ const MAVEN_GPG_PASSPHRASE_DEFAULT_ENV = 'MAVEN_GPG_PASSPHRASE';
const GPG_PASSPHRASE_PROFILE_ID = 'setup-java-gpg';
const INPUT_CACHE = 'cache';
const INPUT_CACHE_DEPENDENCY_PATH = 'cache-dependency-path';
const INPUT_CACHE_READ_ONLY = 'cache-read-only';
const constants_INPUT_JOB_STATUS = 'job-status';
const STATE_GPG_PRIVATE_KEY_FINGERPRINT = 'gpg-private-key-fingerprint';
const M2_DIR = '.m2';