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.
We provide defaults for the following, these may also be overridden:
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)
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.