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:
parent
43ea57b96e
commit
10114e7e8a
4 changed files with 24 additions and 2 deletions
|
@ -8,7 +8,7 @@ inputs:
|
||||||
tool_versions:
|
tool_versions:
|
||||||
required: false
|
required: false
|
||||||
description: If present, this value will be written to the .tool-versions file
|
description: If present, this value will be written to the .tool-versions file
|
||||||
outputs::
|
outputs:
|
||||||
cache-hit:
|
cache-hit:
|
||||||
description: 'A boolean value to indicate if a cache was hit.'
|
description: 'A boolean value to indicate if a cache was hit.'
|
||||||
runs:
|
runs:
|
||||||
|
|
9
dist/index.js
generated
vendored
9
dist/index.js
generated
vendored
|
@ -43,11 +43,20 @@ async function run() {
|
||||||
await setToolVersions();
|
await setToolVersions();
|
||||||
await restoreRTXCache();
|
await restoreRTXCache();
|
||||||
await setupRTX();
|
await setupRTX();
|
||||||
|
await setEnvVars();
|
||||||
await exec.exec('rtx', ['--version']);
|
await exec.exec('rtx', ['--version']);
|
||||||
await exec.exec('rtx', ['install']);
|
await exec.exec('rtx', ['install']);
|
||||||
await setPaths();
|
await setPaths();
|
||||||
}
|
}
|
||||||
exports.run = run;
|
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() {
|
async function restoreRTXCache() {
|
||||||
const cachePath = (0, utils_1.rtxDir)();
|
const cachePath = (0, utils_1.rtxDir)();
|
||||||
const fileHash = await glob.hashFiles(`**/.tool-versions\n**/.rtx.toml`);
|
const fileHash = await glob.hashFiles(`**/.tool-versions\n**/.rtx.toml`);
|
||||||
|
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
13
src/main.ts
13
src/main.ts
|
@ -11,11 +11,24 @@ async function run(): Promise<void> {
|
||||||
await setToolVersions()
|
await setToolVersions()
|
||||||
await restoreRTXCache()
|
await restoreRTXCache()
|
||||||
await setupRTX()
|
await setupRTX()
|
||||||
|
await setEnvVars()
|
||||||
await exec.exec('rtx', ['--version'])
|
await exec.exec('rtx', ['--version'])
|
||||||
await exec.exec('rtx', ['install'])
|
await exec.exec('rtx', ['install'])
|
||||||
await setPaths()
|
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> {
|
async function restoreRTXCache(): Promise<void> {
|
||||||
const cachePath = rtxDir()
|
const cachePath = rtxDir()
|
||||||
const fileHash = await glob.hashFiles(`**/.tool-versions\n**/.rtx.toml`)
|
const fileHash = await glob.hashFiles(`**/.tool-versions\n**/.rtx.toml`)
|
||||||
|
|
Loading…
Add table
Reference in a new issue