This Action for AWS enables arbitrary actions for interacting with AWS services via the aws
command-line client.
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"]
}
AWS_ACCESS_KEY_ID
– Required The AWS access key part of your credentials (more info)AWS_SECRET_ACCESS_KEY
– Required The AWS secret access key part of your credentials (more info)
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 tous-east-1
(more info)AWS_DEFAULT_OUTPUT
- Optional The CLI's output output format, defaults tojson
(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)
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.