5
0
Fork 0
mirror of https://github.com/hashicorp/vault-action.git synced 2025-11-09 16:16:55 +00:00

fix: move to core.setSecret from command.addMask

This commit is contained in:
Tom North 2023-03-25 14:38:39 +00:00
parent c2f2763a3d
commit 66e37e9d98
2 changed files with 7 additions and 7 deletions

View file

@ -73,7 +73,7 @@ async function exportSecrets() {
defaultOptions.headers['X-Vault-Token'] = vaultToken; defaultOptions.headers['X-Vault-Token'] = vaultToken;
const client = got.extend(defaultOptions); const client = got.extend(defaultOptions);
command.issue('add-mask', vaultToken); core.setSecret(vaultToken)
if (outputToken === true) { if (outputToken === true) {
core.setOutput('vault_token', `${vaultToken}`); core.setOutput('vault_token', `${vaultToken}`);
} }
@ -107,7 +107,7 @@ async function exportSecrets() {
for (const line of value.replace(/\r/g, '').split('\n')) { for (const line of value.replace(/\r/g, '').split('\n')) {
if (line.length > 0) { if (line.length > 0) {
command.issue('add-mask', line); core.setSecret(line);
} }
} }
if (exportEnv) { if (exportEnv) {

View file

@ -333,9 +333,9 @@ describe('exportSecrets', () => {
await exportSecrets(); await exportSecrets();
expect(command.issue).toBeCalledTimes(2); expect(core.setSecret).toBeCalledTimes(2);
expect(command.issue).toBeCalledWith('add-mask', 'secret'); expect(core.setSecret).toBeCalledWith('secret');
expect(core.setOutput).toBeCalledWith('key', 'secret'); expect(core.setOutput).toBeCalledWith('key', 'secret');
}) })
@ -353,10 +353,10 @@ with blank lines
await exportSecrets(); await exportSecrets();
expect(command.issue).toBeCalledTimes(3); // 1 for each non-empty line. expect(core.setSecret).toBeCalledTimes(3); // 1 for each non-empty line.
expect(command.issue).toBeCalledWith('add-mask', 'a multi-line string'); expect(core.setSecret).toBeCalledWith('a multi-line string');
expect(command.issue).toBeCalledWith('add-mask', 'with blank lines'); expect(core.setSecret).toBeCalledWith('with blank lines');
expect(core.setOutput).toBeCalledWith('key', multiLineString); expect(core.setOutput).toBeCalledWith('key', multiLineString);
}) })