From 740d8a44f871d6d44fd2869cc8ba692fc0aef614 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 8 Jul 2020 23:25:49 +0000 Subject: [PATCH] chore: Update dist --- dist/index.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/dist/index.js b/dist/index.js index 604ff4b..364be22 100644 --- a/dist/index.js +++ b/dist/index.js @@ -155,6 +155,7 @@ async function assumeRole(params) { roleDurationSeconds, roleSessionName, region, + roleSkipSessionTagging } = params; assert( [sourceAccountId, roleToAssume, roleDurationSeconds, roleSessionName, region].every(isDefined), @@ -174,20 +175,23 @@ async function assumeRole(params) { // Supports only 'aws' partition. Customers in other partitions ('aws-cn') will need to provide full ARN roleArn = `arn:aws:iam::${sourceAccountId}:role/${roleArn}`; } + const tagArray = [ + {Key: 'GitHub', Value: 'Actions'}, + {Key: 'Repository', Value: GITHUB_REPOSITORY}, + {Key: 'Workflow', Value: sanitizeGithubWorkflowName(GITHUB_WORKFLOW)}, + {Key: 'Action', Value: GITHUB_ACTION}, + {Key: 'Actor', Value: sanitizeGithubActor(GITHUB_ACTOR)}, + {Key: 'Branch', Value: GITHUB_REF}, + {Key: 'Commit', Value: GITHUB_SHA}, + ]; + + const roleSessionTags = roleSkipSessionTagging ? undefined : tagArray; const assumeRoleRequest = { RoleArn: roleArn, RoleSessionName: roleSessionName, DurationSeconds: roleDurationSeconds, - Tags: [ - {Key: 'GitHub', Value: 'Actions'}, - {Key: 'Repository', Value: GITHUB_REPOSITORY}, - {Key: 'Workflow', Value: sanitizeGithubWorkflowName(GITHUB_WORKFLOW)}, - {Key: 'Action', Value: GITHUB_ACTION}, - {Key: 'Actor', Value: sanitizeGithubActor(GITHUB_ACTOR)}, - {Key: 'Branch', Value: GITHUB_REF}, - {Key: 'Commit', Value: GITHUB_SHA}, - ] + Tags: roleSessionTags }; if (roleExternalId) { @@ -329,7 +333,8 @@ 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 }); + if (!region.match(REGION_REGEX)) { throw new Error(`Region is not valid: ${region}`); } @@ -366,7 +371,8 @@ async function run() { roleToAssume, roleExternalId, roleDurationSeconds, - roleSessionName + roleSessionName, + roleSkipSessionTagging }); exportCredentials(roleCredentials); await validateCredentials(roleCredentials.accessKeyId);