diff --git a/dist/index.js b/dist/index.js index cdefa6e..8ea2f0a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -389,7 +389,8 @@ async function run() { const region = core.getInput('aws-region', { required: true }); const roleToAssume = core.getInput('role-to-assume', { required: false }); const audience = core.getInput('audience', { required: false }); - const maskAccountId = core.getBooleanInput('mask-aws-account-id', { required: false }); + const maskAccountIdInput = core.getInput('mask-aws-account-id', { required: false }) || 'false'; + const maskAccountId = maskAccountIdInput.toLowerCase() === 'true'; const roleExternalId = core.getInput('role-external-id', { required: false }); const webIdentityTokenFile = core.getInput('web-identity-token-file', { required: false }); const roleDuration = parseInt(core.getInput('role-duration-seconds', { required: false })) || DEFAULT_ROLE_DURATION; diff --git a/src/index.ts b/src/index.ts index 63b9aaf..c4dbb5a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,8 @@ export async function run() { const region = core.getInput('aws-region', { required: true }); const roleToAssume = core.getInput('role-to-assume', { required: false }); const audience = core.getInput('audience', { required: false }); - const maskAccountId = core.getBooleanInput('mask-aws-account-id', { required: false }); + const maskAccountIdInput = core.getInput('mask-aws-account-id', { required: false }) || 'false'; + const maskAccountId = maskAccountIdInput.toLowerCase() === 'true'; const roleExternalId = core.getInput('role-external-id', { required: false }); const webIdentityTokenFile = core.getInput('web-identity-token-file', { required: false }); const roleDuration = parseInt(core.getInput('role-duration-seconds', { required: false })) || DEFAULT_ROLE_DURATION; diff --git a/test/index.test.ts b/test/index.test.ts index 51415c2..a71c915 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -86,7 +86,6 @@ describe('Configure AWS Credentials', () => { mockedSTS.reset(); (fromEnv as jest.Mock).mockReset(); jest.spyOn(core, 'getMultilineInput').mockImplementation(() => []); - jest.spyOn(core, 'getBooleanInput').mockImplementation(); jest.spyOn(core, 'getIDToken').mockImplementation(async () => Promise.resolve('testtoken')); jest.spyOn(core, 'exportVariable').mockImplementation(); jest.spyOn(core, 'setSecret').mockImplementation(); @@ -139,7 +138,7 @@ describe('Configure AWS Credentials', () => { expect(mockedSTS.commandCalls(AssumeRoleCommand)).toHaveLength(0); expect(core.exportVariable).toHaveBeenCalledTimes(5); - expect(core.setSecret).toHaveBeenCalledTimes(3); + expect(core.setSecret).toHaveBeenCalledTimes(4); expect(core.exportVariable).toHaveBeenCalledWith('AWS_ACCESS_KEY_ID', FAKE_ACCESS_KEY_ID); expect(core.setSecret).toHaveBeenCalledWith(FAKE_ACCESS_KEY_ID); expect(core.exportVariable).toHaveBeenCalledWith('AWS_SECRET_ACCESS_KEY', FAKE_SECRET_ACCESS_KEY); @@ -278,7 +277,6 @@ describe('Configure AWS Credentials', () => { test('can opt into masking account ID', async () => { const mockInputs = { ...CREDS_INPUTS, 'aws-region': 'us-east-1', 'mask-aws-account-id': 'true' }; jest.spyOn(core, 'getInput').mockImplementation(mockGetInput(mockInputs)); - jest.spyOn(core, 'getBooleanInput').mockImplementation(() => true); await run();