From cdf00718de740295e8731d3720406839877b6c40 Mon Sep 17 00:00:00 2001 From: Aiden Fujiwara Date: Tue, 5 Mar 2024 10:18:33 -0800 Subject: [PATCH] restructure --- src/main.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index c1e73da..8afe086 100644 --- a/src/main.ts +++ b/src/main.ts @@ -48,14 +48,16 @@ async function run(): Promise { await exec("chmod +x .foreman-install/foreman"); } - if ((artifactoryUrl == "") != (artifactoryToken == "")) { + await foreman.authenticate(githubToken); + + if (artifactoryUrl != "" && artifactoryToken != "") { // both defined + await foreman.addArtifactoryToken(artifactoryUrl, artifactoryToken); + } else if (artifactoryUrl != "" || artifactoryToken != "") { // only one defined throw new Error( "Both artifactory-url and artifactory-token must be set or null" ); } - await foreman.authenticate(githubToken); - await foreman.addArtifactoryToken(artifactoryUrl, artifactoryToken); foreman.addBinDirToPath(); if (workingDir !== undefined && workingDir !== null && workingDir !== "") {