-
Notifications
You must be signed in to change notification settings - Fork 4
38 lines (31 loc) · 1.61 KB
/
provider-ci-triggered-by-webhook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Provider contract test performed via webhook
# https://docs.pact.io/pact_broker/overview/#webhooks
# When a new contract is published by the consumer (frontend) it was not executed
# with any version of the provider, so the pactflow runs a webhook that calls this
# pipeline and runs the provider contract test (clients-service), directly downloading
# the new contract (via 'pactUrl') and publishing the result to pactflow at the end.
# With this it is possible to guarantee that every new contract published is
# compatible or not with the version of the production provider.
# Using this webhook event allows the changed pact to be tested against the head, test and production versions of the provider,
# in the same way as the consumer version selectors allow the head, test and production versions of the pact to be tested against a version of the provider.
on:
repository_dispatch:
types: [contract_requiring_verification_published]
jobs:
test-contract:
runs-on: ubuntu-22.04
name: Run provider contract
steps:
- name: Project checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.sha }}
- run: docker-compose build provider-test-contract
- name: Run provider contract test
run: make provider-test-contract
env:
PACT_URL: ${{ github.event.client_payload.pact_url }}
GIT_COMMIT: ${{ github.event.client_payload.sha }}
GIT_BRANCH: ${{ github.event.client_payload.branch }}
DESCRIPTION: ${{ github.event.client_payload.message }}
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}