Skip to content

Commit 2ff418f

Browse files
committed
Parse language before calling getCredentials
1 parent 527501d commit 2ff418f

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

lib/start-proxy-action.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start-proxy-action.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
Credential,
1313
getCredentials,
1414
getDownloadUrl,
15+
parseLanguage,
1516
UPDATEJOB_PROXY,
1617
} from "./start-proxy";
1718
import {
@@ -133,11 +134,13 @@ async function runWrapper() {
133134
core.saveState("proxy-log-file", proxyLogFilePath);
134135

135136
// Get the configuration options
137+
const languageInput = actionsUtil.getOptionalInput("language");
138+
const language = languageInput ? parseLanguage(languageInput) : undefined;
136139
const credentials = getCredentials(
137140
logger,
138141
actionsUtil.getOptionalInput("registry_secrets"),
139142
actionsUtil.getOptionalInput("registries_credentials"),
140-
actionsUtil.getOptionalInput("language"),
143+
language,
141144
);
142145

143146
if (credentials.length === 0) {

src/start-proxy.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ test("getCredentials filters by language when specified", async (t) => {
109109
getRunnerLogger(true),
110110
undefined,
111111
toEncodedJSON(mixedCredentials),
112-
"java",
112+
KnownLanguage.java,
113113
);
114114
t.is(credentials.length, 1);
115115
t.is(credentials[0].type, "maven_repository");
@@ -120,7 +120,7 @@ test("getCredentials returns all for a language when specified", async (t) => {
120120
getRunnerLogger(true),
121121
undefined,
122122
toEncodedJSON(mixedCredentials),
123-
"go",
123+
KnownLanguage.go,
124124
);
125125
t.is(credentials.length, 2);
126126

src/start-proxy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ export function getCredentials(
7979
logger: Logger,
8080
registrySecrets: string | undefined,
8181
registriesCredentials: string | undefined,
82-
languageString: string | undefined,
82+
language: KnownLanguage | undefined,
8383
): Credential[] {
84-
const language = languageString ? parseLanguage(languageString) : undefined;
8584
const registryTypeForLanguage = language
8685
? LANGUAGE_TO_REGISTRY_TYPE[language]
8786
: undefined;

0 commit comments

Comments
 (0)