Hello team, I'm using `infracost comment github` c...
# help
a
Hello team, I'm using
infracost comment github
comment in my github actions pipeline, and I'm facing the error:
err: invalid Infracost JSON file version. Supported versions are 0.2 ≤ x ≤ 0.2
I'm using the same JSON file for
infracost breakdown
command and its shows relevant output. Can someone please help me on this
c
Hi, can you paste the relevant parts of your actions pipeline
a
Copy code
- name: Infracost for ${{ github.event.inputs.project_name }} in ${{ github.event.inputs.region }}
        if: ${{ (env.spoke_subscription_id != null) && (github.event.inputs.infracost == 'true') }}
        run: |
          infracost configure set api_key ${{ secrets.INFRACOST_API_KEY }}
          infracost breakdown --path /tmp/infracost/${{ env.spoke_subscription_id }}-${{ github.event.inputs.ritm }}-${{ github.run_id }}-${{ github.event.inputs.project_name }}-level3-*.json
          infracost comment github --path=/tmp/infracost/${{ env.spoke_subscription_id }}-${{ github.event.inputs.ritm }}-${{ github.run_id }}-${{ github.event.inputs.project_name }}-level3-*.json \
            --repo=${GITHUB_REPOSITORY} \
            --pull-request=${{needs.pull-request.outputs.output-number}} \
            --github-token=${{ secrets.PAT }} \
            --behavior=update
c
ok so it looks like
/tmp/infracost/${{ env.spoke_subscription_id }}-${{ github.event.inputs.ritm }}-${{ github.run_id }}-${{ github.event.inputs.project_name }}-level3-*.json
is a terraform plan.json file right?
infracost comment
needs --path set to the output of the
infracost breakdown
command in JSON format. You should add the
--format=json --out-file=/tmp/infracost-out.json
to breakdown, and change comment to
infracost comment github --path=/tmp/infracost-out.json …
a
It worked !! Thank you so much