bug: only install tools if tool-versions is set (#45)
* bug: only install tools if tool-versions is set Avoids a warning * bug: only install tools if tool-versions is set Avoids a warning
This commit is contained in:
parent
6b2eb66125
commit
d3b6ed3fdf
3 changed files with 14 additions and 6 deletions
8
dist/index.js
generated
vendored
8
dist/index.js
generated
vendored
|
@ -48,9 +48,10 @@ const path = __importStar(__nccwpck_require__(17));
|
|||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield setupRTX();
|
||||
yield setToolVersions();
|
||||
yield exec.exec('rtx', ['--version']);
|
||||
yield exec.exec('rtx', ['install']);
|
||||
if (yield setToolVersions()) {
|
||||
yield exec.exec('rtx', ['install']);
|
||||
}
|
||||
yield setPaths();
|
||||
});
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ function setupRTX() {
|
|||
core.addPath(rtxBinDir);
|
||||
});
|
||||
}
|
||||
// returns true if tool_versions was set
|
||||
function setToolVersions() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const toolVersions = core.getInput('tool_versions', { required: false });
|
||||
|
@ -82,7 +84,9 @@ function setToolVersions() {
|
|||
yield fs.promises.writeFile('.tool-versions', toolVersions, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function getOS() {
|
||||
|
|
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
10
src/main.ts
10
src/main.ts
|
@ -6,9 +6,10 @@ import * as path from 'path'
|
|||
|
||||
async function run(): Promise<void> {
|
||||
await setupRTX()
|
||||
await setToolVersions()
|
||||
await exec.exec('rtx', ['--version'])
|
||||
await exec.exec('rtx', ['install'])
|
||||
if (await setToolVersions()) {
|
||||
await exec.exec('rtx', ['install'])
|
||||
}
|
||||
await setPaths()
|
||||
}
|
||||
|
||||
|
@ -31,13 +32,16 @@ async function setupRTX(): Promise<void> {
|
|||
core.addPath(rtxBinDir)
|
||||
}
|
||||
|
||||
async function setToolVersions(): Promise<void> {
|
||||
// returns true if tool_versions was set
|
||||
async function setToolVersions(): Promise<Boolean> {
|
||||
const toolVersions = core.getInput('tool_versions', {required: false})
|
||||
if (toolVersions) {
|
||||
await fs.promises.writeFile('.tool-versions', toolVersions, {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function getOS(): string {
|
||||
|
|
Loading…
Add table
Reference in a new issue