Skip to content

Commit

Permalink
refactor: Prune duplicate lines (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris authored Jan 3, 2020
1 parent 8b130ac commit 87208c9
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,23 @@ export async function showVersion(
// most @actions toolkit packages have async methods
export async function run(): Promise<any> {
try {
const mdbookVersion: string = core.getInput('mdbook-version');
let toolVersion: string = core.getInput('mdbook-version');
let installVersion: string = '';

let result: actionResult = {
exitcode: 0,
output: '',
error: ''
};

if (mdbookVersion === '' || mdbookVersion === 'latest') {
const latestVersion: string = await getLatestVersion(
'rust-lang',
'mdbook',
'brew'
);
console.log(`mdbook version: ${latestVersion} (${mdbookVersion})`);
await installer(latestVersion);
if (toolVersion === '' || toolVersion === 'latest') {
installVersion = await getLatestVersion('rust-lang', 'mdbook', 'brew');
} else {
console.log(`mdbook version: ${mdbookVersion}`);
await installer(mdbookVersion);
installVersion = toolVersion;
}

console.log(`mdbook version: ${installVersion}`);
await installer(installVersion);
result = await showVersion('mdbook', ['--version']);

return result;
Expand Down

0 comments on commit 87208c9

Please sign in to comment.