Skip to content

Commit

Permalink
Create ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiraalA authored Apr 4, 2024
1 parent b42e16c commit f0eb20a
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Update Pull Request

Check failure on line 1 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / scan

CKV2_GHA_1: "Ensure top-level permissions are not set to write-all"
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 }}\`
<details><summary>Show Plan</summary>
\`\`\`
${process.env.PLAN}
\`\`\`
</details>
*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
})

0 comments on commit f0eb20a

Please sign in to comment.