From e28fc5f742dfc8e646bc8c5f31f1d4708fce2a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Herna=CC=81ndez?= Date: Fri, 7 Jul 2023 15:07:47 +0200 Subject: [PATCH] Fix app launching --- src/action/main.ts | 6 +++++- src/modules/coursier.ts | 12 ++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/action/main.ts b/src/action/main.ts index a269d30e..9a021b63 100644 --- a/src/action/main.ts +++ b/src/action/main.ts @@ -46,7 +46,11 @@ async function run(): Promise { core.exportVariable('ROOT_LOG_LEVEL', 'TRACE') } - await coursier.launch('org.scala-steward:scala-steward-core_2.13', inputs.steward.version, [ + const app = inputs.steward.version + ? `org.scala-steward:scala-steward-core_2.13:${inputs.steward.version.value}` + : 'scala-steward' + + await coursier.launch(app, [ arg('--workspace', workspace.workspace), arg('--repos-file', workspace.repos_md), arg('--git-ask-pass', workspace.askpass_sh), diff --git a/src/modules/coursier.ts b/src/modules/coursier.ts index dd9e8118..e3c27b6f 100644 --- a/src/modules/coursier.ts +++ b/src/modules/coursier.ts @@ -63,25 +63,21 @@ export async function install(): Promise { * * Refer to [coursier](https://get-coursier.io/docs/cli-launch) for more information. * - * @param app - The application's artifact name. - * @param version - The application's version. + * @param app - The application to launch * @param args - The args to pass to the application launcher. */ export async function launch( app: string, - version: NonEmptyString | undefined, args: Array = [], ): Promise { - const name = version ? `${app}:${version.value}` : app - - core.startGroup(`Launching ${name}`) + core.startGroup(`Launching ${app}`) const launchArgs = [ 'launch', '--contrib', '-r', 'sonatype:snapshots', - name, + app, '--', ...args.flatMap((arg: string | string[]) => (typeof arg === 'string' ? [arg] : arg)), ] @@ -95,7 +91,7 @@ export async function launch( core.endGroup() if (code !== 0) { - throw new Error(`Launching ${name} failed`) + throw new Error(`Launching ${app} failed`) } }