mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Use Language type
This commit is contained in:
19
lib/start-proxy-action.js
generated
19
lib/start-proxy-action.js
generated
@@ -39,6 +39,7 @@ const core = __importStar(require("@actions/core"));
|
||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||
const node_forge_1 = require("node-forge");
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const languages_1 = require("./languages");
|
||||
const logging_1 = require("./logging");
|
||||
const util = __importStar(require("./util"));
|
||||
const UPDATEJOB_PROXY = "update-job-proxy";
|
||||
@@ -48,9 +49,17 @@ const PROXY_USER = "proxy_user";
|
||||
const KEY_SIZE = 2048;
|
||||
const KEY_EXPIRY_YEARS = 2;
|
||||
const LANGUAGE_TO_REGISTRY_TYPE = {
|
||||
"java-kotlin": "maven_repository",
|
||||
java: "maven_repository",
|
||||
csharp: "nuget_feed",
|
||||
javascript: "npm_registry",
|
||||
python: "python_index",
|
||||
ruby: "rubygems_server",
|
||||
rust: "cargo_registry",
|
||||
// We do not have an established proxy type for these languages, thus leaving empty.
|
||||
actions: "",
|
||||
cpp: "",
|
||||
go: "",
|
||||
swift: "",
|
||||
};
|
||||
const CERT_SUBJECT = [
|
||||
{
|
||||
@@ -175,7 +184,11 @@ async function startProxy(binPath, config, logFilePath, logger) {
|
||||
function getCredentials(logger) {
|
||||
const registriesCredentials = actionsUtil.getOptionalInput("registries_credentials");
|
||||
const registrySecrets = actionsUtil.getOptionalInput("registry_secrets");
|
||||
const language = actionsUtil.getOptionalInput("language");
|
||||
const languageString = actionsUtil.getOptionalInput("language");
|
||||
const language = languageString ? (0, languages_1.parseLanguage)(languageString) : undefined;
|
||||
const registryTypeForLanguage = language
|
||||
? LANGUAGE_TO_REGISTRY_TYPE[language]
|
||||
: undefined;
|
||||
let credentialsStr;
|
||||
if (registriesCredentials !== undefined) {
|
||||
logger.info(`Using registries_credentials input.`);
|
||||
@@ -198,7 +211,7 @@ function getCredentials(logger) {
|
||||
}
|
||||
// Filter credentials based on language if specified. `type` is the registry type.
|
||||
// E.g., "maven_feed" for Java/Kotlin, "nuget_repository" for C#.
|
||||
if (language && LANGUAGE_TO_REGISTRY_TYPE[language] !== e.type) {
|
||||
if (e.type !== registryTypeForLanguage) {
|
||||
continue;
|
||||
}
|
||||
out.push({
|
||||
|
||||
Reference in New Issue
Block a user