Added ability to disable automatic action caching. (#212)

This commit is contained in:
Robbie Plankenhorn 2023-12-12 16:04:07 -05:00 committed by GitHub
parent f0a88fe39d
commit 0e7059cb40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 2 deletions

View file

@ -12,6 +12,10 @@ inputs:
required: false
default: "true"
description: 'if false, will not run `rtx install`'
cache:
required: false
default: "true"
description: 'if false, action will not automatically cache'
outputs:
cache-hit:
description: 'A boolean value to indicate if a cache was hit.'

9
dist/index.js generated vendored
View file

@ -82932,7 +82932,14 @@ const path = __importStar(__nccwpck_require__(1017));
const utils_1 = __nccwpck_require__(1314);
async function run() {
await setToolVersions();
await restoreRTXCache();
if (core.getBooleanInput('cache')) {
await restoreRTXCache();
core.saveState('CACHE', false);
}
else {
core.saveState('CACHE', true);
core.setOutput('cache-hit', false);
}
await setupRTX();
await setEnvVars();
await exec.exec('rtx', ['--version']);

View file

@ -12,6 +12,13 @@ export async function run(): Promise<void> {
}
async function cacheRTXTools(): Promise<void> {
const skipCache = core.getState('CACHE')
if (skipCache) {
core.info('Skipping saving cache')
return
}
const state = core.getState('CACHE_KEY')
const primaryKey = core.getState('PRIMARY_KEY')
const cachePath = rtxDir()

View file

@ -9,7 +9,15 @@ import { rtxDir } from './utils'
async function run(): Promise<void> {
await setToolVersions()
await restoreRTXCache()
if (core.getBooleanInput('cache')) {
await restoreRTXCache()
core.saveState('CACHE', false)
} else {
core.saveState('CACHE', true)
core.setOutput('cache-hit', false)
}
await setupRTX()
await setEnvVars()
await exec.exec('rtx', ['--version'])