Hi. I'm getting the following error when running ...
# help
w
Hi. I'm getting the following error when running infracost via github actions: This is using the github infracost.yml template for a mono-repo and the workflow step example provided. Namely: - name: Infracost Actions uses: infracost/actions@v2.0.0 Any assistance greatly appreciated.
b
Hello! Can you post your workflow here? Have you have anything else in there apart from Infracost example?
Quick fix might be adding
shell: bash
to the steps, but I wonder what causes this issue
Copy code
- name: Setup Infracost
        uses: infracost/actions/setup@v2
You need just setup action to install CLI
w
Strangely it worked in our dev /stg/tst environments but not when pushed to main. Invoked as a job step in another workflow as follows: - name: Infracost Actions uses: infracost/actions@v2.0.0
b
Hm, interesting. The workflow is identical to the example 🙂
Can you try adding
shell: bash
to this step?
w
Would that be for this step. - name: Infracost Actions uses: infracost/actions@v2.0.0
b
Hm, I'm sorry, do I understand correctly that the code you showed is workflow 1, but you're trying invoke it from workflow 2?
I wonder if our default action needs to have a shell because it executes the CLI commands
See the line 38 of your log: it corresponds to this line in our action https://github.com/infracost/actions/blob/master/action.yml#L37
Using
uses: infracost/actions@v2.0.0
will call our default action
w
We have a workflow called pull-request-builder.yml that includes the code above, however there is also an infracost.yml as per the examples. So are you saying we do not need the infracost.yml file ? ALso when I added shell I got the following:
b
Thanks for the info. Seems like we should use a different syntax to reuse your infracost.yml workflow. Calling
infracost/actions
would use our's downloaded from GitHub
w
OK. Many thanks., I will give that a try. 👍
b
I'm sorry, I've never done this myself, but according to GitHub docs, this is called "reusable workflow" https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow
w
Cheers. I will have a read up...
b
Hope this helps! Please ping me if you need more help 🙂
w
Will do. Many thanks
j
@worried-agency-87622 not sure if this is helpful, but here is a called workflow we use for Infracost: https://github.com/osinfra-io/github-terraform-gcp-called-workflows/blob/main/.github/workflows/infracost.yml and this is an example of how a caller would use it: https://github.com/osinfra-io/google-cloud-hierarchy/blob/main/.github/workflows/infracost.yml
b
Awesome! Thanks for the example Brett! 🙂
w
@jolly-pilot-68525 Excellent. Many thanks.