robburger / terraform-pr-commenter

A GitHub Action that adds opinionated comments to a PR from Terraform fmt/init/plan output
MIT License
129 stars 63 forks source link

Terraform fmt comment output wrongly with -diff option #31

Open aminzar-access opened 2 years ago

aminzar-access commented 2 years ago

Hi, When using -diff option for terraform fmt, the comment in PR looks weird. Thanks for looking into this.

image

      - name: Terraform Format
        id: fmt
        run: terraform -chdir=${{ env.working_directory}} fmt -check -recursive -diff
        continue-on-error: true

      - name: Post Format Result
        if: always() && github.event_name == 'pull_request' && (steps.fmt.outcome == 'success' || steps.fmt.outcome == 'failure')
        uses: robburger/terraform-pr-commenter@v1.5.0
        with:
          commenter_type: fmt
          commenter_input: ${{ format('{0}{1}', steps.fmt.outputs.stdout, steps.fmt.outputs.stderr) }}
          commenter_exitcode: ${{ steps.fmt.outputs.exitcode }}