From d01b1704c411fddf8bad07287238254b42db8424 Mon Sep 17 00:00:00 2001 From: Parag Bhingre Date: Tue, 11 May 2021 14:28:41 -0400 Subject: [PATCH] fix: skips session tagging --- index.js | 11 +++++++++-- index.test.js | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 5aa4bb782..018aac3e9 100644 --- a/index.js +++ b/index.js @@ -57,6 +57,12 @@ async function assumeRole(params) { const roleSessionTags = roleSkipSessionTagging ? undefined : tagArray; + if(roleSessionTags == undefined){ + core.debug("Role session tagging has been skipped.") + } else { + core.debug(roleSessionTags.length + " role session tags are being used.") + } + const assumeRoleRequest = { RoleArn: roleArn, RoleSessionName: roleSessionName, @@ -203,8 +209,9 @@ async function run() { const roleExternalId = core.getInput('role-external-id', { required: false }); const roleDurationSeconds = core.getInput('role-duration-seconds', {required: false}) || MAX_ACTION_RUNTIME; const roleSessionName = core.getInput('role-session-name', { required: false }) || ROLE_SESSION_NAME; - const roleSkipSessionTagging = core.getInput('role-skip-session-tagging', { required: false }); - + const roleSkipSessionTaggingInput = core.getInput('role-skip-session-tagging', { required: false })|| 'false'; + const roleSkipSessionTagging = roleSkipSessionTaggingInput.toLowerCase() === 'true'; + if (!region.match(REGION_REGEX)) { throw new Error(`Region is not valid: ${region}`); } diff --git a/index.test.js b/index.test.js index 8fa322a29..f2295c991 100644 --- a/index.test.js +++ b/index.test.js @@ -559,7 +559,7 @@ describe('Configure AWS Credentials', () => { test('skip tagging provided as true', async () => { core.getInput = jest .fn() - .mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': true})); + .mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': 'true'})); await run(); expect(mockStsAssumeRole).toHaveBeenCalledWith({ @@ -573,7 +573,7 @@ describe('Configure AWS Credentials', () => { test('skip tagging provided as false', async () => { core.getInput = jest .fn() - .mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': false})); + .mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': 'false'})); await run(); expect(mockStsAssumeRole).toHaveBeenCalledWith({