GetTerminus / terraform-pr-commenter

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

When running matrix for multiple environment the commenter only work for one environment #35

Open RamBNarayanan opened 5 months ago

RamBNarayanan commented 5 months ago

Hi

I am using the commenter to add comments for multiple environment with a PR. But this is only adding comment for the first environment when running a matrix in parallel.

- uses: GetTerminus/terraform-pr-commenter@v3
      if: github.event_name == 'pull_request'
      env:
        GITHUB_TOKEN: ${{ github.token }}
        TF_WORKSPACE: ${{ inputs.environment }}
      with:
        commenter_type: plan
        commenter_plan_path: ${{ inputs.tf_directory }}/tf_plan_${{ inputs.environment }}.txt
        commenter_exitcode: ${{ steps.plan.outputs.exitcode }}

matrix details

strategy:
      max-parallel: 4
      matrix:
        environment: [dev,prd]

both dev and prod has run but only dev comments are added

image

Dev Run details below


Run docker run \ INFO: Found commenter plan file. INFO: Found 1 page(s) of comments at https://api.github.com/repos/LiberisFinance/Liberis.Quote.Api/issues/493/comments?per_page=100. INFO: Looking for an existing plan PR comment. INFO: No existing plan PR comment found. INFO: Found 1 page(s) of comments at https://api.github.com/repos/LiberisFinance/Liberis.Quote.Api/issues/493/comments?per_page=100. INFO: Looking for an existing outputs PR comment. INFO: No existing outputs PR comment found. INFO: Writing 1 plan comment(s) INFO: Adding plan comment to PR. INFO: Writing 0 outputs comment(s)

Prd Run details below


Run docker run \ INFO: Found commenter plan file. INFO: Found 1 page(s) of comments at https://api.github.com/repos/LiberisFinance/Liberis.Quote.Api/issues/493/comments?per_page=100. INFO: Looking for an existing plan PR comment. INFO: No existing plan PR comment found. INFO: Found 1 page(s) of comments at https://api.github.com/repos/LiberisFinance/Liberis.Quote.Api/issues/493/comments?per_page=100. INFO: Looking for an existing outputs PR comment. INFO: No existing outputs PR comment found. INFO: Writing 0 plan comment(s) INFO: Writing 0 outputs comment(s)

RamBNarayanan commented 5 months ago

The issues seems to be intermittent as well

IanMoroney commented 1 month ago

@RamBNarayanan , i've forked this and made it compatible with opentofu, so if you're using opentofu instead of terraform, this will work: https://github.com/phoenix-actions/opentofu-pr-commenter