@@ -8,6 +8,7 @@ import { pki } from "node-forge";
8
8
import * as actionsUtil from "./actions-util" ;
9
9
import { getActionsLogger , Logger } from "./logging" ;
10
10
import * as util from "./util" ;
11
+ import { Language , parseLanguage } from "./languages" ;
11
12
12
13
const UPDATEJOB_PROXY = "update-job-proxy" ;
13
14
const UPDATEJOB_PROXY_VERSION = "v2.0.20241023203727" ;
@@ -17,10 +18,18 @@ const PROXY_USER = "proxy_user";
17
18
const KEY_SIZE = 2048 ;
18
19
const KEY_EXPIRY_YEARS = 2 ;
19
20
20
- const LANGUAGE_TO_REGISTRY_TYPE = {
21
- "java-kotlin" : "maven_repository" ,
21
+ const LANGUAGE_TO_REGISTRY_TYPE : Record < Language , string > = {
22
22
java : "maven_repository" ,
23
23
csharp : "nuget_feed" ,
24
+ javascript : "npm_registry" ,
25
+ python : "python_index" ,
26
+ ruby : "rubygems_server" ,
27
+ rust : "cargo_registry" ,
28
+ // We do not have an established proxy type for these languages, thus leaving empty.
29
+ actions : "" ,
30
+ cpp : "" ,
31
+ go : "" ,
32
+ swift : "" ,
24
33
} as const ;
25
34
26
35
type CertificateAuthority = {
@@ -198,7 +207,9 @@ function getCredentials(logger: Logger): Credential[] {
198
207
"registries_credentials" ,
199
208
) ;
200
209
const registrySecrets = actionsUtil . getOptionalInput ( "registry_secrets" ) ;
201
- const language = actionsUtil . getOptionalInput ( "language" ) ;
210
+ const languageString = actionsUtil . getOptionalInput ( "language" ) ;
211
+ const language = languageString ? parseLanguage ( languageString ) : undefined ;
212
+ const registryTypeForLanguage = language ? LANGUAGE_TO_REGISTRY_TYPE [ language ] : undefined ;
202
213
203
214
let credentialsStr : string ;
204
215
if ( registriesCredentials !== undefined ) {
@@ -222,8 +233,8 @@ function getCredentials(logger: Logger): Credential[] {
222
233
223
234
// Filter credentials based on language if specified. `type` is the registry type.
224
235
// E.g., "maven_feed" for Java/Kotlin, "nuget_repository" for C#.
225
- if ( language && LANGUAGE_TO_REGISTRY_TYPE [ language ] !== e . type ) {
226
- continue ;
236
+ if ( e . type != registryTypeForLanguage ) {
237
+ continue ;
227
238
}
228
239
229
240
out . push ( {
0 commit comments