Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skips session tagging #209

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}`);
}
Expand Down
4 changes: 2 additions & 2 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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({
Expand Down