Skip to content

Commit

Permalink
comment to PR
Browse files Browse the repository at this point in the history
  • Loading branch information
tjcorr authored Oct 7, 2021
1 parent 09f8855 commit 620c663
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- main
pull_request:
branches:
- main

jobs:
terraform-plan:
Expand Down Expand Up @@ -65,6 +67,25 @@ jobs:
path: tfplan

# If this is a PR post the changes
# todo does this work if i push another commit to the PR?
- name: Push Terraform Output to PR
if: github.ref != 'refs/heads/main'
uses: actions/github-script@v2
env:
PLAN: "${{ steps.tf-plan.outputs.stderr }}\n${{ steps.tf-plan.outputs.stdout }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = ` ### Terraform Plan Report
\`\`\`${process.env.PLAN}\`\`\` `;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
# If this isn't PR do a job to apply

Expand Down

0 comments on commit 620c663

Please sign in to comment.