You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
DynamoDB Actions
v1.1.3
GitHub action that integrates with Amazon DynamoDB.
Inspired from DynamoDB integration in AWS Step Functions
Get Item from DynamoDB and Returns JSON-serialized Item payload.
# ...
jobs:
job:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Get DynamoDB Item
id: config
uses: mooyoul/dynamodb-actions@v1.1.1
env:
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
with:
operation: get
region: us-east-1
table: my-awesome-config
key: |
{ key: "foo" }
- name: Print Value
run: jq '.field' <<< ${{ steps.config.outputs.item }}
type GetItemInput = {
operation: "get";
region: string;
table: string;
key: string; // JSON-serialized key
consistent?: boolean;
}
JSON-serialized item will be set to item
output.
Put Item to DynamoDB
# ...
jobs:
job:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Put DynamoDB Item
uses: mooyoul/dynamodb-actions@v1.1.1
env:
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
with:
operation: put
region: us-east-1
table: my-awesome-config
item: |
{
key: "foo",
value: "wow",
awesome: true,
stars: 12345
}
type PutItemInput = {
operation: "put";
region: string;
table: string;
item: string; // JSON-serialized item
}
None.
Delete Item from DynamoDB
# ...
jobs:
job:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Delete DynamoDB Item
uses: mooyoul/dynamodb-actions@v1.1.1
env:
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
with:
operation: delete
region: us-east-1
table: my-awesome-config
key: |
{ key: "foo" }
type DeleteItemInput = {
operation: "delete";
region: string;
table: string;
key: string; // JSON-serialized key
}
None
Use Github Actions built-in fromJson
function.
For example:
- name: Print specific field
run: |
echo ${{ fromJson(steps.[id].outputs.item).[field] }}
Alternatively, You can also Use jq. Github-hosted runners already have pre-installed jq..
For example:
- name: Print specific field
run: |
jq '.field' <<< echo '${{ steps.[id].outputs.item }}'
- Add UpdateItem operation
- Add conditional writes (e.g. putItem / updateItem)
See full license on mooyoul.mit-license.org