diff --git a/src/cleanup-java.ts b/src/cleanup-java.ts index a890c4b6..e52de8ef 100644 --- a/src/cleanup-java.ts +++ b/src/cleanup-java.ts @@ -23,7 +23,8 @@ async function removePrivateKeyFromKeychain() { async function saveCache() { const jobStatus = isJobStatusSuccess(); const cache = core.getInput(constants.INPUT_CACHE); - return jobStatus && cache ? save(cache) : Promise.resolve(); + const readOnlyCache = core.getInput(constants.INPUT_CACHE_READ_ONLY) + return jobStatus && cache && !readOnlyCache ? save(cache) : Promise.resolve(); } /** diff --git a/src/constants.ts b/src/constants.ts index 94d7667f..a5fdfeea 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -17,6 +17,7 @@ export const INPUT_DEFAULT_GPG_PRIVATE_KEY = undefined; export const INPUT_DEFAULT_GPG_PASSPHRASE = 'GPG_PASSPHRASE'; export const INPUT_CACHE = 'cache'; +export const INPUT_CACHE_READ_ONLY = "cache-is-read-only"; export const INPUT_JOB_STATUS = 'job-status'; export const STATE_GPG_PRIVATE_KEY_FINGERPRINT = 'gpg-private-key-fingerprint';