Skip to content

Commit

Permalink
Fix app launching
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrohdezma committed Jul 7, 2023
1 parent e03f72e commit e28fc5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/action/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ async function run(): Promise<void> {
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),
Expand Down
12 changes: 4 additions & 8 deletions src/modules/coursier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,21 @@ export async function install(): Promise<void> {
*
* 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<string | string[]> = [],
): Promise<void> {
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)),
]
Expand All @@ -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`)
}
}

Expand Down

0 comments on commit e28fc5f

Please sign in to comment.