infracost/actions

Infracost comment github --tag

Laucans opened this issue · 5 comments

Hi,

Context

Got a github repository which manage 2 environment, prod and non-prod. Theses environment are managed by github-action through matrix.

Infracost setup :

      - name: Setup Infracost
        uses: infracost/actions/setup@v1

Got an issue with the following command

infracost comment github --path /tmp/infracost-${{ matrix.environment }}.json \
                                   --repo $GITHUB_REPOSITORY \
                                   --github-token ${{github.token}} \
                                   --pull-request ${{github.event.pull_request.number}} \
                                   --behavior update \
                                   --tag "${{ matrix.environment }}"

Issue

The behaviour of --tag seems wrong.
Because of matrix job is executed twice.

  • The first one for example non-prod create a new comment which containing the tag "non-prod"
  • The second one, prod, update the comment created by non-prod and replace the tag

Expected

  • The first one non-prod create a new comment which contains the tag "non-prod"
  • The second one, prod, create a new comment which contains the tag "prod"

@Laucans thanks for creating this issue! Can you please try using the tags "prod" and "dev" to see if that fixes the issue? I suspect the issue here is that "prod" is a substring of "non-prod" so the matching logic is not properly differentiating between them.

@alikhajeh1 thanks for answer.

So I tested with dev and prod and got the same behavior :
image

I can't show the tag when it has been updated but if I change for behavior new :

image

image

Oh wait, the matching logic take the whole message body, dev is in my project name..

Ok I changed dev for development and it's working.

Thank you.

This is fixed in 0.9.23