Skip to content

Commit f502642

Browse files
refactor(index): create constant for default cli name
1 parent 3626cc1 commit f502642

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ import path from 'path';
1111

1212
import { getBinaryPath, getDownloadObject } from './utils';
1313

14+
const DEFAULT_NAME = 'gh';
15+
1416
export async function run() {
1517
try {
1618
// Get the version and name of the tool to be installed
1719
const cliVersion = getInput('cli-version');
18-
const cliName = getInput('cli-name');
20+
const cliName = getInput('cli-name') || DEFAULT_NAME;
1921
const toolName = cliName;
2022

2123
// Find previously cached directory (if applicable)
@@ -39,8 +41,11 @@ export async function run() {
3941
binaryPath = getBinaryPath(binaryDirectory, cliName);
4042

4143
// Rename the binary
42-
if (cliName !== 'gh') {
43-
await exec('mv', [getBinaryPath(binaryDirectory, 'gh'), binaryPath]);
44+
if (cliName !== DEFAULT_NAME) {
45+
await exec('mv', [
46+
getBinaryPath(binaryDirectory, DEFAULT_NAME),
47+
binaryPath,
48+
]);
4449
}
4550
}
4651

0 commit comments

Comments
 (0)