diff --git a/src/cli.ts b/src/cli.ts index dc704a1..c46a229 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -273,10 +273,7 @@ async function run() { console.log(`Fetching latest release for ${repository}...`); const release = await fetchLatestRelease(repository, token); - const asset = getMatchingAsset(release.assets, platformInfo, { - fileName: options.fileName, - fileType: options.fileType - }); + const asset = getMatchingAsset(release.assets, platformInfo, options.fileName, options.fileType); const version = release.tag_name.replace(/^v/i, ''); const downloadUrl = asset.browser_download_url; diff --git a/src/core/matcher.ts b/src/core/matcher.ts index e73e8d5..75fe8fc 100644 --- a/src/core/matcher.ts +++ b/src/core/matcher.ts @@ -1,10 +1,5 @@ import { PlatformInfo } from './platform'; -export interface MatchOptions { - fileName?: string; - fileType?: string; -} - function normalizeCustomExtensionPattern(fileType: string): string { let pattern = fileType; @@ -89,8 +84,7 @@ function matchSingleAssetByRegex(assets: any[], pattern: string, noMatchError: s return matchingAssets[0]; } -export function getMatchingAsset(assets: any[], platform: PlatformInfo, options: MatchOptions): any { - const { fileName, fileType } = options; +export function getMatchingAsset(assets: any[], platform: PlatformInfo, fileName?: string, fileType?: string): any { const extPattern = getExtPattern(fileType, platform.system); if (!fileName || fileName.startsWith('~')) { diff --git a/src/index.ts b/src/index.ts index c1569a2..ad86422 100644 --- a/src/index.ts +++ b/src/index.ts @@ -91,10 +91,7 @@ async function run() { core.info(`Fetching latest release information for ${repository}...`); const release = await fetchLatestRelease(repository, token); - const asset = getMatchingAsset(release.assets, platformInfo, { - fileName: fileNameInput, - fileType: fileType - }); + const asset = getMatchingAsset(release.assets, platformInfo, fileNameInput, fileType); core.info(`Selected asset: ${asset.name}`);