Hi, I have a question related to the github action...
# pactflow
p
Hi, I have a question related to the github action. I run:
Copy code
- name: Publish provider contract on passing test run
        uses: pactflow/actions/publish-provider-contract@v1.2.0
        env:
          oas_file: ${{ env.OPENAPI_FILE }}
          results_file: ${{ env.CHANGELOG_FILE }}
          version: ${{ steps.prepare-env.outputs.version }}
          PACT_BROKER_TOKEN: ${{ env.TOKEN_IDP_PACTFLOW }}
but I get this error about the
yaml
file being missing:
Copy code
Status: Downloaded newer image for pactfoundation/pact-cli:latest
/usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pactflow/client/cli/provider_contract_commands.rb:75:in `read': No such file or directory @ rb_sysopen - openapi.yaml (Errno::ENOENT)
	from /usr/lib/ruby/gems/3.2.0/gems/pact_broker-client-1.75.1/lib/pactflow/client/cli/provider_contract_commands.rb:75
but the file is definitely there. Is there a way to confirm the execution path of the task, or something?
y
it volumes mounts from the root of your workspace, have you checked out your codebase beforehand? can you share more of your workflow? and ls the workspace prior to running the publish step? you can sh into the docker container so you could run something like
Copy code
docker run --rm \
  -w ${PWD} \
  -v ${PWD}:${PWD} \
  -e PACT_BROKER_BASE_URL=$PACT_BROKER_BASE_URL \
  -e PACT_BROKER_TOKEN=$PACT_BROKER_TOKEN \
  pactfoundation/pact-cli:latest sh -c 'ls'
p
ah so the code run in a github action. I can make this work from local, no problem, but in a GHA using
uses: pactflow/actions/publish-provider-contract@v1.2.0
it fails. I run this in the action, as mentioned:
Copy code
- name: Publish provider contract on passing test run
        uses: pactflow/actions/publish-provider-contract@v1.2.0
        env:
          oas_file: ${{ env.OPENAPI_FILE }}
          results_file: ${{ env.CHANGELOG_FILE }}
          version: ${{ steps.prepare-env.outputs.version }}
          PACT_BROKER_TOKEN: ${{ env.TOKEN_IDP_PACTFLOW }}
there is a checkout step before
y
ls
the workspace prior to running the publish step to confirm env.OPENAPI_FILE is indeed available at the working directory
p
yes, it is available, is not empty, and has the correct values and name 😞 I’ll try to run it via a normal sh script calling docker, as it does under the hood, to compare
aha so yes, if I run the docker command directly it works, the gha fails, so something is not propagating the working directory correctly to docker inside the action Not a big deal, I can run the command, so all good 😄