-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
64 lines (56 loc) · 2.02 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Build Changeset Comment
author: Chandler Newby
description: Github Action that creates a GFMD comment with Cloudformation changeset details.
branding:
icon: cloud
color: orange
inputs:
changes_json_file:
description: Pass the path to the changeset file
required: false
changeset_arn:
description: Pass the ARN of the changeset you want to describe.
required: false
outputs:
comment:
description: The markdown formatted description of the changeset
value: ${{ steps.build-comment.outputs.comment }}
comment_json:
description: The markdown formatted description of the changeset, in an escaped json string
value: ${{ steps.build-comment.outputs.comment_json }}
runs:
using: 'composite'
steps:
- name: Check inputs
shell: bash
run: |
changes_json_file="${{ inputs.changes_json_file }}"
changeset_arn="${{ inputs.changeset_arn }}"
if [[ -n "$changes_json_file" && -n "$changeset_arn" ]]; then
echo "Please only specify changes_json_file OR changeset_arn, not both."
exit 1
elif [[ -z "$changes_json_file" && -z "$changeset_arn" ]]; then
echo "Please specify either changes_json_file or changeset_arn."
exit 1
fi
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Get the changeset details
id: get-changeset-details
if: inputs.changeset_arn != ''
shell: bash
run: |
echo 'raw_changes<<EOF' >> $GITHUB_OUTPUT
aws cloudformation describe-change-set --region $(echo $ARN | cut -d ':' -f 4) --change-set-name $ARN >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
env:
ARN: ${{ inputs.changeset_arn }}
- name: Build the comment
id: build-comment
run: python "$GITHUB_ACTION_PATH/src/build-markdown.py"
shell: bash
env:
CHANGES_JSON_FILE: ${{ inputs.changes_json_file }}
RAW_CHANGES: ${{ steps.get-changeset-details.outputs.raw_changes }}