Code cleanup
This commit is contained in:
16
src/utils.ts
16
src/utils.ts
@@ -30,7 +30,7 @@ export const validateAuth = (): void => {
|
||||
core.info(`Authenticated with ${authType}.`);
|
||||
};
|
||||
|
||||
export const getEnvVarNamesWithSecretRefs = (): string[] =>
|
||||
const getEnvVarNamesWithSecretRefs = (): string[] =>
|
||||
Object.keys(process.env).filter(
|
||||
(key) =>
|
||||
typeof process.env[key] === "string" &&
|
||||
@@ -58,8 +58,6 @@ export const extractSecret = (
|
||||
envName: string,
|
||||
shouldExportEnv: boolean,
|
||||
): void => {
|
||||
core.info(`Populating variable: ${envName}`);
|
||||
|
||||
const ref = process.env[envName];
|
||||
if (!ref) {
|
||||
return;
|
||||
@@ -70,16 +68,8 @@ export const extractSecret = (
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldExportEnv) {
|
||||
core.exportVariable(envName, secretValue);
|
||||
} else {
|
||||
core.setOutput(envName, secretValue);
|
||||
}
|
||||
// Skip setSecret for empty strings to avoid the warning:
|
||||
// "Can't add secret mask for empty string in ##[add-mask] command."
|
||||
if (secretValue) {
|
||||
core.setSecret(secretValue);
|
||||
}
|
||||
setResolvedSecret(envName, secretValue, shouldExportEnv);
|
||||
|
||||
};
|
||||
|
||||
// Connect loads secrets via the 1Password CLI
|
||||
|
||||
Reference in New Issue
Block a user