Skip to content

Latest commit

 

History

History
 
 

cli

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

GitHub Actions for AWS

This Action for AWS enables arbitrary actions for interacting with AWS services via the aws command-line client.

Usage

An example workflow for creating and publishing to Simple Notification Service (SNS) topic follows.

The example illustrates a pattern for consuming a previous action's output using jq, made possible since each aws Action's output is captured by default as JSON in $GITHUB_HOME/$GITHUB_ACTION.json:

workflow "Publish to SNS topic" {
  on = "push"
  resolves = ["Publish"]
}

action "Topic" {
  uses = "actions/aws/cli@master"
  args = "sns create-topic --name my-topic"
  secrets = ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"]
}

action "Publish" {
  needs = ["Topic"]
  uses = "actions/aws/cli@master"
  args = "sns publish --topic-arn `jq .TopicArn /github/home/Topic.json --raw-output` --subject \"[$GITHUB_REPOSITORY] Code was pushed to $GITHUB_REF\" --message file://$GITHUB_EVENT_PATH"
  secrets = ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"]
}

Secrets

  • AWS_ACCESS_KEY_IDRequired The AWS access key part of your credentials (more info)
  • AWS_SECRET_ACCESS_KEYRequired The AWS secret access key part of your credentials (more info)

Environment variables

All environment variables listed in the official documentation are supported.

The most common environment variables are:

  • AWS_DEFAULT_REGION- Optional The AWS region name, defaults to us-east-1 (more info)
  • AWS_DEFAULT_OUTPUT- Optional The CLI's output output format, defaults to json (more info)
  • AWS_CONFIG_FILE - Optional A path to an AWS config file, combined with $GITHUB_WORKSPACE this can reference files within the repo. For example ${GITHUB_WORKSPACE}/.aws/config will use the file at .aws/config within the repository as the AWS config file. Do not commit .aws/credentials to your repo, keep your secrets in the secrets api. No default is provided (more info)

License

The Dockerfile and associated scripts and documentation in this project are released under the MIT License.

Container images built with this project include third party materials. See THIRD_PARTY_NOTICE.md for details.