Wrap the tf plan output so it is more readable in the PR

This commit is contained in:
Rui Chen 2020-05-15 12:57:40 -04:00
parent 3301b9a828
commit 2988520041
No known key found for this signature in database
GPG key ID: 15A594F673F803E8

View file

@ -92,15 +92,17 @@ steps:
- uses: actions/github-script@0.9.0 - uses: actions/github-script@0.9.0
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
env: env:
STDOUT: "```${{ steps.plan.outputs.stdout }}```" STDOUT: "```terraform\n${{ steps.plan.outputs.stdout }}```"
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
script: | script: |
const output = `<details><summary>tf plan:</summary>\n\n${process.env.STDOUT}\n\n</details>`;
github.issues.createComment({ github.issues.createComment({
issue_number: context.issue.number, issue_number: context.issue.number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
body: process.env.STDOUT body: output
}) })
``` ```