Skip to content

Commit 4900858

Browse files
authored
fix: skips session tagging (#209)
1 parent 745b3be commit 4900858

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

index.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ async function assumeRole(params) {
5757

5858
const roleSessionTags = roleSkipSessionTagging ? undefined : tagArray;
5959

60+
if(roleSessionTags == undefined){
61+
core.debug("Role session tagging has been skipped.")
62+
} else {
63+
core.debug(roleSessionTags.length + " role session tags are being used.")
64+
}
65+
6066
const assumeRoleRequest = {
6167
RoleArn: roleArn,
6268
RoleSessionName: roleSessionName,
@@ -203,8 +209,9 @@ async function run() {
203209
const roleExternalId = core.getInput('role-external-id', { required: false });
204210
const roleDurationSeconds = core.getInput('role-duration-seconds', {required: false}) || MAX_ACTION_RUNTIME;
205211
const roleSessionName = core.getInput('role-session-name', { required: false }) || ROLE_SESSION_NAME;
206-
const roleSkipSessionTagging = core.getInput('role-skip-session-tagging', { required: false });
207-
212+
const roleSkipSessionTaggingInput = core.getInput('role-skip-session-tagging', { required: false })|| 'false';
213+
const roleSkipSessionTagging = roleSkipSessionTaggingInput.toLowerCase() === 'true';
214+
208215
if (!region.match(REGION_REGEX)) {
209216
throw new Error(`Region is not valid: ${region}`);
210217
}

index.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ describe('Configure AWS Credentials', () => {
559559
test('skip tagging provided as true', async () => {
560560
core.getInput = jest
561561
.fn()
562-
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': true}));
562+
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': 'true'}));
563563

564564
await run();
565565
expect(mockStsAssumeRole).toHaveBeenCalledWith({
@@ -573,7 +573,7 @@ describe('Configure AWS Credentials', () => {
573573
test('skip tagging provided as false', async () => {
574574
core.getInput = jest
575575
.fn()
576-
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': false}));
576+
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': 'false'}));
577577

578578
await run();
579579
expect(mockStsAssumeRole).toHaveBeenCalledWith({

0 commit comments

Comments
 (0)