Hello, I got the attached error message when I was...
# pactflow
n
Hello, I got the attached error message when I was merging my webhookless consumer into master, i've already merged the provider side with no errors. The step it failed on was publishing the pact step where I run this command:
npx pact-broker publish ./pacts  --branch=$GITHUB_HEAD_REF --broker-base-url=$pact_broker --broker-token=$pact_broker_token --consumer-app-version=${version} --tag testing_tag
. The github workflows always passes on the PR, but for some reason it failed when I tried merging it. I have never see this error before on my PR. The only place I see
consumer_version_number
is here, link but i'm working with the webhookless approach. I took a look at the example webhookless consumer on github that you guys have but I also don't see a consumer_version_number in the workflows anywhere. Please let me know if you'd like me to provide any more information.
m
My suggestion is to echo out the commands with dummy values, my guess is that the variables aren’t being properly interpreted
From memory, you need to specify at the step level which env vars pass through to the step (for security reasons I think)
n
Oh interesting okay I will try this. It is odd though that I don't get any errors when the github workflow runs on the PR only when I merge to master.
m
Debugging Github actions can be challenging. There was a project I recall that ran them on your machine locally as Docker images. I had a really hairy problem a few years ago (it didn’t help) but was a cool project
y
line 18 of your consumer action file
Copy code
version: ${{ github.event.pull_request.head.sha }}
line 41 of your consumer action file
Copy code
run: npx pact-broker publish ./pacts  --branch=$GITHUB_HEAD_REF --broker-base-url=$pact_broker --broker-token=$pact_broker_token --consumer-app-version=${version} --tag testing_tag
your version number is only populated on pull requests but your workflow runs on pushes too, where
github.event.pull_request.head.sha
won't be populated
Copy code
on:
  push:
    branches: [master]
    paths:
      - 'packages/ab-payments/__tests__/**/*.pact.test.js'
  pull_request:
    types: [opened, reopened, synchronize, ready_for_review]
    paths:
      - 'packages/ab-payments/__tests__/**/*.pact.test.js'
as before a full reproducible example is the most helpful thing you can do, ideally in github in a public repository