mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-04 06:15:07 +09:00
fix: skips session tagging (#209)
This commit is contained in:
committed by
GitHub
parent
745b3becf5
commit
4900858c22
@@ -57,6 +57,12 @@ async function assumeRole(params) {
|
|||||||
|
|
||||||
const roleSessionTags = roleSkipSessionTagging ? undefined : tagArray;
|
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 = {
|
const assumeRoleRequest = {
|
||||||
RoleArn: roleArn,
|
RoleArn: roleArn,
|
||||||
RoleSessionName: roleSessionName,
|
RoleSessionName: roleSessionName,
|
||||||
@@ -203,8 +209,9 @@ async function run() {
|
|||||||
const roleExternalId = core.getInput('role-external-id', { required: false });
|
const roleExternalId = core.getInput('role-external-id', { required: false });
|
||||||
const roleDurationSeconds = core.getInput('role-duration-seconds', {required: false}) || MAX_ACTION_RUNTIME;
|
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 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)) {
|
if (!region.match(REGION_REGEX)) {
|
||||||
throw new Error(`Region is not valid: ${region}`);
|
throw new Error(`Region is not valid: ${region}`);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -559,7 +559,7 @@ describe('Configure AWS Credentials', () => {
|
|||||||
test('skip tagging provided as true', async () => {
|
test('skip tagging provided as true', async () => {
|
||||||
core.getInput = jest
|
core.getInput = jest
|
||||||
.fn()
|
.fn()
|
||||||
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': true}));
|
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': 'true'}));
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
expect(mockStsAssumeRole).toHaveBeenCalledWith({
|
expect(mockStsAssumeRole).toHaveBeenCalledWith({
|
||||||
@@ -573,7 +573,7 @@ describe('Configure AWS Credentials', () => {
|
|||||||
test('skip tagging provided as false', async () => {
|
test('skip tagging provided as false', async () => {
|
||||||
core.getInput = jest
|
core.getInput = jest
|
||||||
.fn()
|
.fn()
|
||||||
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': false}));
|
.mockImplementation(mockGetInput({...ASSUME_ROLE_INPUTS, 'role-skip-session-tagging': 'false'}));
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
expect(mockStsAssumeRole).toHaveBeenCalledWith({
|
expect(mockStsAssumeRole).toHaveBeenCalledWith({
|
||||||
|
|||||||
Reference in New Issue
Block a user