infracost/actions

Usage of PR_NUMBER while using reusable workflow .

samarth3112 opened this issue · 3 comments

I have a master workflow which calls the actual terraform workflow .
While sending PR_NO: ${{github.event.pull_request.number}} to the called workflow , its not able to pick the number of the PR to comment .

with:
PR_NO: ${{github.event.pull_request.number}}

@samarth3112 thank you - are you able to post the full workflow you are using to give us some more context about this issue?

@aliscott the caller workflow is calling the actual workflow .Let me give you a example with fictitious code .

caller:->

on:
push:

jobs:
deploy:
- uses: my-org/my-workflow-repo./.github/workflows/reusable.yml@v1
with:
PR_NO: ${{github.event.pull_request.number}}


In called workflow code is something like this .

on:
workflow_call:
inputs:
PR_NO:
required: true
type: string

-name : Run it here cost
run : |

infracost comment github --repo $GITHUB_REPOSITORY --pull-request ${{ inputs.PR_NO }} etc etc


Error: invalid argument "--path" for "--pull-request" flag: must be integer

@samarth3112 I'm wondering if it's because you are using on: [push] instead of on: [pull_request], so GitHub doesn't have the pull request context for some of the runs.