Adding Setting of Necessary Environment Variables Before Running rtx (#123)

* Fixing typo in outputs of action.yml

* Adding `setEnvVars` step for env vars that should always be set in the action
This commit is contained in:
Yousif Akbar 2023-08-18 11:29:16 -04:00 committed by GitHub
parent 43ea57b96e
commit 10114e7e8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 2 deletions

View file

@ -8,7 +8,7 @@ inputs:
tool_versions:
required: false
description: If present, this value will be written to the .tool-versions file
outputs::
outputs:
cache-hit:
description: 'A boolean value to indicate if a cache was hit.'
runs:

9
dist/index.js generated vendored
View file

@ -43,11 +43,20 @@ async function run() {
await setToolVersions();
await restoreRTXCache();
await setupRTX();
await setEnvVars();
await exec.exec('rtx', ['--version']);
await exec.exec('rtx', ['install']);
await setPaths();
}
exports.run = run;
async function setEnvVars() {
if (!process.env['RTX_TRUSTED_CONFIG_PATHS']) {
core.exportVariable('RTX_TRUSTED_CONFIG_PATHS', path.join(process.cwd(), '.rtx.toml'));
}
if (!process.env['RTX_YES']) {
core.exportVariable('RTX_YES', 'yes');
}
}
async function restoreRTXCache() {
const cachePath = (0, utils_1.rtxDir)();
const fileHash = await glob.hashFiles(`**/.tool-versions\n**/.rtx.toml`);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -11,11 +11,24 @@ async function run(): Promise<void> {
await setToolVersions()
await restoreRTXCache()
await setupRTX()
await setEnvVars()
await exec.exec('rtx', ['--version'])
await exec.exec('rtx', ['install'])
await setPaths()
}
async function setEnvVars(): Promise<void> {
if (!process.env['RTX_TRUSTED_CONFIG_PATHS']) {
core.exportVariable(
'RTX_TRUSTED_CONFIG_PATHS',
path.join(process.cwd(), '.rtx.toml')
)
}
if (!process.env['RTX_YES']) {
core.exportVariable('RTX_YES', 'yes')
}
}
async function restoreRTXCache(): Promise<void> {
const cachePath = rtxDir()
const fileHash = await glob.hashFiles(`**/.tool-versions\n**/.rtx.toml`)