Skip to content

Commit

Permalink
Merge pull request #2 from youyo/feature/github-actions
Browse files Browse the repository at this point in the history
Add
  • Loading branch information
youyo committed Nov 9, 2019
2 parents 93cd4b4 + efcd80a commit 313a944
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
19 changes: 19 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'AWS Assume role GitHub Actions'
description: 'Runs awscredswrap via GitHub Actions.'
author: 'youyo <1003ni2@gmail.com>'
branding:
icon: 'terminal'
color: 'blue'
inputs:
duration_seconds:
description: 'The duration, in seconds, of the role session. (default 3600)'
default: 3600
role_arn:
description: 'The arn of the role to assume.'
required: true
role_session_name:
description: 'An identifier for the assumed role session.'
default: 'awscredswrap@GitHubActions'
runs:
using: 'docker'
image: 'github-actions/Dockerfile'
7 changes: 7 additions & 0 deletions github-actions/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM youyo/awscredswrap:latest

LABEL maintainer "youyo <1003ni2@gmail.com>"

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
13 changes: 13 additions & 0 deletions github-actions/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

eval $(/awscredswrap --role-arn ${INPUT_ROLE_ARN} --role-session-name ${INPUT_ROLE_SESSION_NAME} --duration-seconds ${INPUT_DURATION_SECONDS})

echo ::add-mask::${AWS_ACCESS_KEY_ID}
echo ::add-mask::${AWS_SECRET_ACCESS_KEY}
echo ::add-mask::${AWS_SESSION_TOKEN}
echo ::add-mask::${AWS_DEFAULT_REGION}

echo ::set-env name=AWS_ACCESS_KEY_ID::${AWS_ACCESS_KEY_ID}
echo ::set-env name=AWS_SECRET_ACCESS_KEY::${AWS_SECRET_ACCESS_KEY}
echo ::set-env name=AWS_SESSION_TOKEN::${AWS_SESSION_TOKEN}
echo ::set-env name=AWS_DEFAULT_REGION::${AWS_DEFAULT_REGION}

0 comments on commit 313a944

Please sign in to comment.