From f0eb20a96c643009a13d57004d8b06bf48a0825b Mon Sep 17 00:00:00 2001 From: Admiral Date: Thu, 4 Apr 2024 07:16:08 +0200 Subject: [PATCH] Create ci.yml --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fb92811 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: Update Pull Request +on: + pull_request: + types: [opened, synchronize] + +jobs: + update_pull_request: + runs-on: ubuntu-latest + steps: + - name: Terraform Format + run: terraform fmt -check + id: fmt + + - name: Terraform Initialize + run: terraform init + id: init + + - name: Terraform Plan + run: terraform plan + id: plan + continue-on-error: true + + - name: Create Pull Request Comment + if: always() + uses: actions/github-script@1.2.0 + env: + PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const output = ` + #### Terraform Format and Style 🖌 \`${{ steps.fmt.outcome }}\` + #### Terraform Initialization ⚙️ \`${{ steps.init.outcome }}\` + #### Terraform Plan 📖 \`${{ steps.plan.outcome }}\` + +
Show Plan + + \`\`\` + ${process.env.PLAN} + \`\`\` + +
+ + *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; + + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + })