mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Apply suggestions from code review
This commit is contained in:
18
lib/config-utils.js
generated
18
lib/config-utils.js
generated
@@ -919,10 +919,12 @@ async function initConfig(languagesInput, queriesInput, packsInput, registriesIn
|
||||
exports.initConfig = initConfig;
|
||||
function parseRegistries(registriesInput) {
|
||||
try {
|
||||
return registriesInput ? yaml.l(registriesInput) : undefined;
|
||||
return registriesInput
|
||||
? yaml.load(registriesInput)
|
||||
: undefined;
|
||||
}
|
||||
catch (e) {
|
||||
throw new Error(`Invalid registries input. Must be a JSON string, but got: ${e instanceof Error ? e.message : String(e)}`);
|
||||
throw new Error("Invalid registries input. Must be a YAML string.");
|
||||
}
|
||||
}
|
||||
function isLocal(configPath) {
|
||||
@@ -1054,6 +1056,18 @@ function createRegistriesBlock(registries) {
|
||||
};
|
||||
return qlconfig;
|
||||
}
|
||||
/**
|
||||
* Create a temporary environment based on the existing environment and overridden
|
||||
* by the given environment variables that are passed in as arguments.
|
||||
*
|
||||
* Use this new environment in the context of the given operation. After completing
|
||||
* the operation, restore the original environment.
|
||||
*
|
||||
* This function does not support un-setting environment variables.
|
||||
*
|
||||
* @param env
|
||||
* @param operation
|
||||
*/
|
||||
async function wrapEnvironment(env, operation) {
|
||||
// Remember the original env
|
||||
const oldEnv = { ...process.env };
|
||||
|
||||
Reference in New Issue
Block a user