diff --git a/.github/workflows/no_aws_credential.yml b/.github/workflows/no_aws_credential.yml deleted file mode 100644 index 3d86c7a..0000000 --- a/.github/workflows/no_aws_credential.yml +++ /dev/null @@ -1,20 +0,0 @@ -on: - pull_request: - branches: - - master - types: opened -jobs: - list-change-stack: - runs-on: ubuntu-latest - name: list cfn stack change set - steps: - - name: checkout - uses: actions/checkout@v2 - - name: describe change set - id: describe-change-set - uses: ./ - with: - stack_name: omochi - template_body: after.cf.yml - - name: echo output - run: echo "Result was ${{ steps.describe-change-set.outputs.result }}" diff --git a/.github/workflows/no_diff.yml b/.github/workflows/no_diff.yml deleted file mode 100644 index 022cd98..0000000 --- a/.github/workflows/no_diff.yml +++ /dev/null @@ -1,45 +0,0 @@ -on: - pull_request: - types: [opened, synchronize] -jobs: - list-change-stack: - runs-on: ubuntu-latest - name: list cfn stack change set - steps: - - name: checkout - uses: actions/checkout@v2 - - name: configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ap-northeast-1 - - name: describe change set - id: describe-change-set - uses: ./ - with: - stack_name: omochi - template_body: before.cf.yml - - - name: archive diff - uses: actions/upload-artifact@v1 - with: - name: diff - path: ${{ steps.describe-change-set.outputs.diff_file_path }} - - - name: Download diff markdown - uses: actions/download-artifact@v1 - with: - name: diff - - - name: Post comments - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - URL: ${{ github.event.pull_request.comments_url }} - FILE_PATH: ${{ steps.describe-change-set.outputs.diff_file_path }} - run: | - cat ${FILE_PATH} | xargs echo - curl -X POST \ - -H "Authorization: token ${GITHUB_TOKEN}" \ - -d "{\"body\": \"$(cat ${FILE_PATH} | xargs echo)\"}" \ - ${URL} \ No newline at end of file diff --git a/.github/workflows/no_iam_policy.yml b/.github/workflows/no_iam_policy.yml deleted file mode 100644 index 35ecee1..0000000 --- a/.github/workflows/no_iam_policy.yml +++ /dev/null @@ -1,31 +0,0 @@ -on: - pull_request: - branches: - - master - types: opened -jobs: - list-change-stack: - runs-on: ubuntu-latest - name: list cfn stack change set - steps: - - name: checkout - uses: actions/checkout@v2 - - name: configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.NO_IAM_POLICY_AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.NO_IAM_POLICY_AWS_SECRET_ACCESS_KEY }} - aws-region: ap-northeast-1 - - name: describe change set - id: describe-change-set - uses: ./ - with: - stack_name: omochi - template_body: after.cf.yml - - name: echo output - run: echo "Result was ${{ steps.describe-change-set.outputs.result }}" - - name: archive change set - uses: actions/upload-artifact@v1 - with: - name: change-set-archive - path: ${{ steps.describe-change-set.outputs.result_file_path }} diff --git a/.github/workflows/no_stack_found.yml b/.github/workflows/no_stack_found.yml deleted file mode 100644 index e468e54..0000000 --- a/.github/workflows/no_stack_found.yml +++ /dev/null @@ -1,31 +0,0 @@ -on: - pull_request: - branches: - - master - types: opened -jobs: - list-change-stack: - runs-on: ubuntu-latest - name: list cfn stack change set - steps: - - name: checkout - uses: actions/checkout@v2 - - name: configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ap-northeast-1 - - name: describe change set - id: describe-change-set - uses: ./ - with: - stack_name: warabimochi - template_body: after.cf.yml - - name: echo output - run: echo "Result was ${{ steps.describe-change-set.outputs.result }}" - - name: archive change set - uses: actions/upload-artifact@v1 - with: - name: change-set-archive - path: ${{ steps.describe-change-set.outputs.file_path }} diff --git a/.github/workflows/no_stack_name_provided.yml b/.github/workflows/no_stack_name_provided.yml deleted file mode 100644 index 731619d..0000000 --- a/.github/workflows/no_stack_name_provided.yml +++ /dev/null @@ -1,30 +0,0 @@ -on: - pull_request: - branches: - - master - types: opened -jobs: - list-change-stack: - runs-on: ubuntu-latest - name: list cfn stack change set - steps: - - name: checkout - uses: actions/checkout@v2 - - name: configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ap-northeast-1 - - name: describe change set - id: describe-change-set - uses: ./ - with: - template_body: after.cf.yml - - name: echo output - run: echo "Result was ${{ steps.describe-change-set.outputs.result }}" - - name: archive change set - uses: actions/upload-artifact@v1 - with: - name: change-set-archive - path: ${{ steps.describe-change-set.outputs.file_path }} diff --git a/.github/workflows/no_template_body_provided.yml b/.github/workflows/no_template_body_provided.yml deleted file mode 100644 index 7394788..0000000 --- a/.github/workflows/no_template_body_provided.yml +++ /dev/null @@ -1,30 +0,0 @@ -on: - pull_request: - branches: - - master - types: opened -jobs: - list-change-stack: - runs-on: ubuntu-latest - name: list cfn stack change set - steps: - - name: checkout - uses: actions/checkout@v2 - - name: configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ap-northeast-1 - - name: describe change set - id: describe-change-set - uses: ./ - with: - stack_name: omochi - - name: echo output - run: echo "Result was ${{ steps.describe-change-set.outputs.result }}" - - name: archive change set - uses: actions/upload-artifact@v1 - with: - name: change-set-archive - path: ${{ steps.describe-change-set.outputs.file_path }} diff --git a/Dockerfile b/Dockerfile index ef24bd9..70a1a4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,13 @@ FROM python:3 RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ - && unzip awscliv2.zip \ + && unzip -q awscliv2.zip \ && ./aws/install RUN apt-get update \ && apt-get install -y less jq COPY entrypoint.sh /entrypoint.sh +COPY pretty_format.py /pretty_format.py ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index d05543e..d86b9a0 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ ex. describe change set diff like management console. - name: describe change set id: describe-change-set - uses: Blue-Pix/describe-cfn-change-set@v2 + uses: Blue-Pix/describe-cfn-change-set@v2.1 with: stack_name: omochi template_body: after.cf.yml diff --git a/entrypoint.sh b/entrypoint.sh index 573771a..d1c8d89 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,10 +29,10 @@ if [ ${status} != "CREATE_COMPLETE" ] && [ ${status} != "FAILED" ]; then exit 1 fi -result=$(cat $uuid.json | jq -c) +result=$(cat $uuid.json | jq -c .) echo "::set-output name=change_set_name::$uuid" echo "::set-output name=result::$result" echo "::set-output name=result_file_path::$uuid.json" -python pretty_format.py $uuid $INPUT_STACK_NAME +python /pretty_format.py $uuid $INPUT_STACK_NAME echo "::set-output name=diff_file_path::$uuid.html" diff --git a/pretty_format.py b/pretty_format.py old mode 100644 new mode 100755