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() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield setupRTX();
|
yield setupRTX();
|
||||||
yield setToolVersions();
|
|
||||||
yield exec.exec('rtx', ['--version']);
|
yield exec.exec('rtx', ['--version']);
|
||||||
yield exec.exec('rtx', ['install']);
|
if (yield setToolVersions()) {
|
||||||
|
yield exec.exec('rtx', ['install']);
|
||||||
|
}
|
||||||
yield setPaths();
|
yield setPaths();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -75,6 +76,7 @@ function setupRTX() {
|
||||||
core.addPath(rtxBinDir);
|
core.addPath(rtxBinDir);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// returns true if tool_versions was set
|
||||||
function setToolVersions() {
|
function setToolVersions() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const toolVersions = core.getInput('tool_versions', { required: false });
|
const toolVersions = core.getInput('tool_versions', { required: false });
|
||||||
|
@ -82,7 +84,9 @@ function setToolVersions() {
|
||||||
yield fs.promises.writeFile('.tool-versions', toolVersions, {
|
yield fs.promises.writeFile('.tool-versions', toolVersions, {
|
||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getOS() {
|
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> {
|
async function run(): Promise<void> {
|
||||||
await setupRTX()
|
await setupRTX()
|
||||||
await setToolVersions()
|
|
||||||
await exec.exec('rtx', ['--version'])
|
await exec.exec('rtx', ['--version'])
|
||||||
await exec.exec('rtx', ['install'])
|
if (await setToolVersions()) {
|
||||||
|
await exec.exec('rtx', ['install'])
|
||||||
|
}
|
||||||
await setPaths()
|
await setPaths()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,13 +32,16 @@ async function setupRTX(): Promise<void> {
|
||||||
core.addPath(rtxBinDir)
|
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})
|
const toolVersions = core.getInput('tool_versions', {required: false})
|
||||||
if (toolVersions) {
|
if (toolVersions) {
|
||||||
await fs.promises.writeFile('.tool-versions', toolVersions, {
|
await fs.promises.writeFile('.tool-versions', toolVersions, {
|
||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
})
|
})
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOS(): string {
|
function getOS(): string {
|
||||||
|
|
Loading…
Add table
Reference in a new issue