Allow users to specify a read-only cache

This can reduce workflow runtime for situations, such as PRs, where
the build artifacts may be disposable and of little use to other workflow runs.
This commit is contained in:
Al Sutton 2021-12-21 13:04:44 +00:00
parent f0bb916062
commit f58da94109
2 changed files with 3 additions and 1 deletions

View file

@ -23,7 +23,8 @@ async function removePrivateKeyFromKeychain() {
async function saveCache() { async function saveCache() {
const jobStatus = isJobStatusSuccess(); const jobStatus = isJobStatusSuccess();
const cache = core.getInput(constants.INPUT_CACHE); 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();
} }
/** /**

View file

@ -17,6 +17,7 @@ export const INPUT_DEFAULT_GPG_PRIVATE_KEY = undefined;
export const INPUT_DEFAULT_GPG_PASSPHRASE = 'GPG_PASSPHRASE'; export const INPUT_DEFAULT_GPG_PASSPHRASE = 'GPG_PASSPHRASE';
export const INPUT_CACHE = 'cache'; export const INPUT_CACHE = 'cache';
export const INPUT_CACHE_READ_ONLY = "cache-is-read-only";
export const INPUT_JOB_STATUS = 'job-status'; export const INPUT_JOB_STATUS = 'job-status';
export const STATE_GPG_PRIVATE_KEY_FINGERPRINT = 'gpg-private-key-fingerprint'; export const STATE_GPG_PRIVATE_KEY_FINGERPRINT = 'gpg-private-key-fingerprint';