How to Trigger Provider Verification With Broker Webhooks
A broker webhook fires on the contract-requiring-verification event and calls your provider CI so verification runs the moment a consumer changes.
Create a webhook that POSTs to the GitHub dispatches API on the contract_requiring_verification_published event, then handle repository_dispatch in the provider workflow.
Steps
- Create a webhook in the broker on the contract-requiring-verification event.
- Point it at the provider repo
dispatchesendpoint with a token. - Handle
repository_dispatchin the provider workflow to run verification.
Provider workflow
.github/workflows/verify.yml
on:
repository_dispatch:
types: [contract_requiring_verification_published]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.sha }}
- run: npm ci && npm run test:providerGotchas
- The broker template variables (like pactUrl and consumerVersionNumber) must be passed in the webhook body so the provider verifies the exact contract.
- Scope the dispatch token to the provider repo only.
Related guides
How to Verify a Provider Against Pacts in CIRun provider verification in CI so the provider fetches consumer pacts from the broker, replays each interact…
How to Use Pending and WIP Pacts to Avoid BlockingEnable pending pacts and work-in-progress pacts so a new or unverified consumer contract does not fail the pr…