diff --git a/actions/terraform/plan/action.yaml b/actions/terraform/plan/action.yaml index 50a8d92e..a2f6d6c8 100644 --- a/actions/terraform/plan/action.yaml +++ b/actions/terraform/plan/action.yaml @@ -141,47 +141,50 @@ runs: - name: Terraform Summary id: action_summary - shell: bash if: always() env: VALIDATE_OUTPUT: ${{ steps.validate.outputs.stdout }} PLAN_OUTPUT: ${{ steps.plan.outputs.stdout }} working-directory: ${{ inputs.working_directory }} - run: | - echo "#"" Terraform ${{ inputs.oidc_type }} ${{ inputs.oidc_value }}" >> $GITHUB_STEP_SUMMARY - - echo "#### Initialization ⚙️\`${{ steps.init.outcome }}\`" >> $GITHUB_STEP_SUMMARY - - echo "#### Format and Style 🖌\`${{ steps.fmt.outcome }}\`" >> $GITHUB_STEP_SUMMARY - - echo "#### Validation 🤖\`${{ steps.validate.outcome }}\`" >> $GITHUB_STEP_SUMMARY - echo "
Validation Output" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "\`\`\`\n" >> $GITHUB_STEP_SUMMARY - echo "${VALIDATE_OUTPUT}" >> $GITHUB_STEP_SUMMARY - echo "\`\`\`" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "
" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - - echo "#### Plan 📖\`${{ steps.plan.outcome }}\`" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "
Show Plan" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "\`\`\`\n" >> $GITHUB_STEP_SUMMARY - echo "${PLAN_OUTPUT}" >> $GITHUB_STEP_SUMMARY - echo "\`\`\`" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "
" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - - echo "| Context | Values |" >> $GITHUB_STEP_SUMMARY - echo "| - | - |" >> $GITHUB_STEP_SUMMARY - echo "| Pusher | @${{ github.actor }} |" >> $GITHUB_STEP_SUMMARY - echo "| Action | \`${{ github.event_name }}\` |" >> $GITHUB_STEP_SUMMARY - echo "| Working Directory | \`${{ inputs.working_directory }}\` |" >> $GITHUB_STEP_SUMMARY - echo "| State | \`${{ env.TF_STATE_FILE }}\` |" >> $GITHUB_STEP_SUMMARY - echo "| Artifact | \`${{ env.ARTIFACT_KEY }}\` |" >> $GITHUB_STEP_SUMMARY + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + // 1. Prep the output + const output = `# Terraform ${{ inputs.oidc_type }} ${{ inputs.oidc_value }} + #### Initialization ⚙️\`${{ steps.init.outcome }}\` + #### Format and Style 🖌\`${{ steps.fmt.outcome }}\` + #### Validation 🤖\`${{ steps.validate.outcome }}\` +
Validation Output + + \`\`\`\n + ${process.env.VALIDATE_OUTPUT} + \`\`\` + +
+ + #### Plan 📖\`${{ steps.plan.outcome }}\` + +
Show Plan + + \`\`\`\n + ${process.env.PLAN_OUTPUT} + \`\`\` + +
+ + | Context | Values | + | - | - | + | Pusher | @${{ github.actor }} | + | Action | \`${{ github.event_name }}\` | + | Working Directory | \`${{ inputs.working_directory }}\` | + | State | \`${{ env.TF_STATE_FILE }}\` | + | Artifact | \`${{ env.ARTIFACT_KEY }}\` |`; + + // 2. Set the output variable + const fs = require('fs'); + fs.writeFileSync('${{ env.tf_actions_working_dir }}/summary.md', output); + core.setOutput('summary', output); - name: GitHub Issue id: issue_number