Skip to content

Commit

Permalink
fix: plan max length
Browse files Browse the repository at this point in the history
  • Loading branch information
nikes committed Jun 8, 2023
1 parent c849bae commit c59e028
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/terraform-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ jobs:

- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
env:
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { readFile } = require("fs/promises")
const data = await readFile('plan.out')
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -81,6 +82,8 @@ jobs:
const botComment = comments.find(comment => {
return comment.user.type === 'Bot' && comment.body.includes('|${{ inputs.operation }}| Terraform Format and Style')
})
const plan = "terraform\n" + data.length > 65000 ? `${data.substring(0, 65000)}...` : data
const output = `#### |${{ inputs.operation }}| Terraform Format and Style: \`${{ steps.fmt.outcome }}\` ${{ steps.fmt.outcome == 'Success' && '✅' || '❌'}}
#### Terraform Initialization: \`${{ steps.init.outcome }}\` ${{ steps.init.outcome == 'Success' && '✅' || '❌'}}
Expand All @@ -89,7 +92,7 @@ jobs:
<details><summary>⏩⏩⏩ Show Plan ⏪⏪⏪</summary>
\`\`\`${process.env.PLAN}\`\`\`
\`\`\`${plan}\`\`\`
</details>`;
if (botComment) {
Expand Down

0 comments on commit c59e028

Please sign in to comment.