Skip to content

Commit 4263e13

Browse files
committed
Filter registry credentials by language
1 parent e83e0a4 commit 4263e13

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

lib/start-proxy-action.js

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

lib/start-proxy-action.js.map

Lines changed: 1 addition & 1 deletion
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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ const PROXY_USER = "proxy_user";
1717
const KEY_SIZE = 2048;
1818
const KEY_EXPIRY_YEARS = 2;
1919

20+
const LANGUAGE_TO_REGISTRY_TYPE: Record<string, string> = {
21+
"java-kotlin": "maven_repository",
22+
"csharp": "nuget_feed",
23+
};
24+
2025
type CertificateAuthority = {
2126
cert: string;
2227
key: string;
@@ -192,6 +197,7 @@ function getCredentials(logger: Logger): Credential[] {
192197
"registries_credentials",
193198
);
194199
const registrySecrets = actionsUtil.getOptionalInput("registry_secrets");
200+
const language = actionsUtil.getOptionalInput("language");
195201

196202
let credentialsStr: string;
197203
if (registriesCredentials !== undefined) {
@@ -212,6 +218,13 @@ function getCredentials(logger: Logger): Credential[] {
212218
if (e.url === undefined && e.host === undefined) {
213219
throw new Error("Invalid credentials - must specify host or url");
214220
}
221+
222+
// Filter credentials based on language if specified. `type` is the registry type.
223+
// E.g., "maven_feed" for Java/Kotlin, "nuget_repository" for C#.
224+
if (language && LANGUAGE_TO_REGISTRY_TYPE[language] !== e.type) {
225+
continue;
226+
}
227+
215228
out.push({
216229
type: e.type,
217230
host: e.host,

start-proxy/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ inputs:
1616
description: GitHub token to use for authenticating with this instance of GitHub, used to upload debug artifacts.
1717
default: ${{ github.token }}
1818
required: false
19+
language:
20+
description: The programming language to setup the proxy for the correct ecosystem
21+
required: false
1922
outputs:
2023
proxy_host:
2124
description: The IP address of the proxy

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy