File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Terraform Plan Comment
22description : Create a terraform plan comment in the PR
33inputs :
4- terraform_plan_file :
5- description : The path to the file containing the contents of the terraform plan
4+ terraform_plan :
5+ description : The contents of the terraform plan
66 required : true
77 terraform_environment :
88 description : Terraform environment
@@ -13,21 +13,20 @@ runs:
1313 steps :
1414 - name : Comment on PR
1515 uses : actions/github-script@v6
16+ env :
17+ PLAN : " ${{ inputs.terraform_plan }}"
1618 with :
1719 script : |
18- const fs = require('fs');
1920 const CODE_BLOCK = '```';
20- const planPath = '${{ inputs.terraform_plan_file }}';
21- const planContents = fs.readFileSync(planPath, 'utf8');
2221
2322 const output = `
24- ### Terraform Plan for ${{ inputs.terraform_environment }} 🔍
23+ ### Terraform Plan ${{ inputs.terraform_environment }} 🔍
2524 <details>
26- <summary>Click to view plan details </summary>
25+ <summary>Logs </summary>
2726
28- ${CODE_BLOCK}terraform
29- ${planContents }
30- ${CODE_BLOCK}
27+ ${ CODE_BLOCK }terraform
28+ ${ process.env.PLAN }
29+ ${ CODE_BLOCK }
3130 </details>
3231
3332 *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*
You can’t perform that action at this time.
0 commit comments