Wrap the tf plan output so it is more readable in the PR (#10)

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

* Remove extra period.

Co-authored-by: Matthew Sanabria <24284972+sudomateo@users.noreply.github.com>

Co-authored-by: Matthew Sanabria <24284972+sudomateo@users.noreply.github.com>
This commit is contained in:
chenrui 2020-05-15 13:27:42 -04:00 committed by GitHub
parent 3301b9a828
commit 813167dada
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
}) })
``` ```
@ -124,7 +126,7 @@ This action does not configure any outputs directly. However, when the `terrafor
- `stderr` - The STDERR stream of the call to the `terraform` binary. - `stderr` - The STDERR stream of the call to the `terraform` binary.
- `exitcode` - The exit code of the call to the `terraform` binary.. - `exitcode` - The exit code of the call to the `terraform` binary.
## License ## License