fix: set outputs/env vars for empty string field values
Empty string field values from 1Password were causing the action to skip setting outputs and environment variables entirely. This was inconsistent with `op run` behavior, which sets the variable with an empty value. - Change falsy check to explicit null/undefined check in extractSecret - Skip setSecret for empty strings to avoid runner warning - Add tests for empty string value handling
This commit is contained in:
@@ -41,7 +41,7 @@ export const extractSecret = (
|
||||
}
|
||||
|
||||
const secretValue = read.parse(ref);
|
||||
if (!secretValue) {
|
||||
if (secretValue === null || secretValue === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,11 @@ export const extractSecret = (
|
||||
} else {
|
||||
core.setOutput(envName, secretValue);
|
||||
}
|
||||
core.setSecret(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);
|
||||
}
|
||||
};
|
||||
|
||||
export const loadSecrets = async (shouldExportEnv: boolean): Promise<void> => {
|
||||
|
||||
Reference in New Issue
Block a user