Does anyone know how to generate a pact file throu...
# general
a
Does anyone know how to generate a pact file through GH actions. I've written a yml script that runs the consumer tests to generate the pacts. The tests are passing, and it's saying pact files generated, but there's no files in my repo, does anyone know how to access the generated file? This is the script output
Copy code
API Pact test
[2022-07-04 10:29:28.863 +0000] INFO (2056 on fv-az459-64): pact@9.17.3: Setting up Pact with Consumer "consumerv1.0.0" and Provider "provider"
    using mock service on Port: "1234"
    ✔ ID 12 exists
[2022-07-04 10:29:28.889 +0000] INFO (2056 on fv-az459-64): pact@9.17.3: Pact File Written
[2022-07-04 10:29:28.890 +0000] INFO (2056 on fv-az459-64): pact-node@10.17.4: Removing Pact process with PID: 2067
[2022-07-04 10:29:28.892 +0000] INFO (2056 on fv-az459-64): pact-node@10.17.4: Deleting Pact Server with options: 
{"timeout":30000,"consumer":"consumerv1.0.0","cors":false,"dir":"/home/runner/work/consumerpoc/consumerpoc/pacts","host":"127.0.0.1","log":"/home/runner/work/consumerpoc/consumerpoc/logs/pact.log","logLevel":"INFO","pactfileWriteMode":"overwrite","provider":"provider","spec":2,"ssl":false,"port":1234,"pactFileWriteMode":"overwrite"}
  1 passing (572ms)
m
There are lots of examples that run on GitHub actions. In fact, probably all of the official ones do and definitely the Pact JS ones that this looks to be using
Why do you need the generated file? You would normally publish it to a pact broker (or a service like Pactflow).
a
How am I supposed to push the file without the file
m
The file should already be on the GitHub servers you should be publishing from
What makes you believe the file isn't there?
All of these examples build and publish from GH: https://docs.pactflow.io/docs/examples
a
Usually when it's ran locally, the file appears in the pacts/ dir
Obviously this can't be added to your GH repo just like that
m
Do you mean it isn't being commited to the repo by the GH action? [I'm not sure you'd want that anyway]
a
No I don't want that, I want to push it to my broker
m
So the file should be in the same relative path that it is locally, just on the remote GH file system.
a
riiiiiggght, makes sense, let me try now
👍 1
m
Hang on, do you actually "need" that file? [vs your Pact tests submitting]
[not sure which of those examples show a broker configured]
a
I need to push the file to my pact broker, I don't "need" it, as in to open it or look at it
basically I need to know where it's located
m
ok
you don't need to know where it is as such, that part can be handled "automatically"
a
Im not using pactflow as my broker, so I have to manually push it
m
If you see the log output you shared above, the exact path is logged in the output
But you should use a relative path
m
I might be misunderstanding something here, apologies if so https://github.com/pact-foundation/pact-workshop-js/#publish-contracts-from-consumer
You don't need to be using PactFlow as the broker, it is the same if you are hosting your own OSS Pact Broker
b
Also, it doesn't need to be committed in your repo, it just needs to be available in the build step runtime.