diff --git a/dist/index.js b/dist/index.js index 27cd46a..a5d23b9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -162,9 +162,9 @@ async function assumeRole(params) { "Missing required input when assuming a Role." ); - const {GITHUB_REPOSITORY, GITHUB_WORKFLOW, GITHUB_ACTION, GITHUB_ACTOR, GITHUB_REF, GITHUB_SHA} = process.env; + const {GITHUB_REPOSITORY, GITHUB_WORKFLOW, GITHUB_ACTION, GITHUB_ACTOR, GITHUB_SHA} = process.env; assert( - [GITHUB_REPOSITORY, GITHUB_WORKFLOW, GITHUB_ACTION, GITHUB_ACTOR, GITHUB_REF, GITHUB_SHA].every(isDefined), + [GITHUB_REPOSITORY, GITHUB_WORKFLOW, GITHUB_ACTION, GITHUB_ACTOR, GITHUB_SHA].every(isDefined), 'Missing required environment value. Are you running in GitHub Actions?' ); @@ -181,10 +181,13 @@ async function assumeRole(params) { {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}, ]; + if (isDefined(process.env.GITHUB_REF)) { + tagArray.push({Key: 'Branch', Value: process.env.GITHUB_REF}); + } + const roleSessionTags = roleSkipSessionTagging ? undefined : tagArray; const assumeRoleRequest = {