Skip to content

Commit

Permalink
terraform: omit plans that exceed comment length limit (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
bendrucker authored Dec 22, 2022
1 parent bb6bfb3 commit 4d73937
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/tf-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,18 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const MAX_PLAN_LENGTH = 60000 // Max comment length is 65536
const plan = '```\n' + process.env.PLAN + '\n```'
const workflowSummaryURL = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
<details><summary>Show Plan</summary>
<details><summary>Show <a href="${workflowSummaryURL}">Plan</a></summary>
\`\`\`\`\n
${process.env.PLAN}
\`\`\`\`
${plan.length <= MAX_PLAN_LENGTH ? plan : `_The plan is too large to include in a comment, open the [workflow summary](${workflowSummaryURL}) to view it._`}
</details>
**Pusher**: @${{ github.actor }}, **Action**: \`${{ github.event_name }}\``;
Expand Down

0 comments on commit 4d73937

Please sign in to comment.