From 3cf421ac3d058d058af489dcfc8f026dfa2233b5 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 19 Aug 2021 11:44:53 +1000 Subject: [PATCH] fix: use provider_version_number from webhook context --- .../webhooks/pact_and_verification_parameters.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/pact_broker/webhooks/pact_and_verification_parameters.rb b/lib/pact_broker/webhooks/pact_and_verification_parameters.rb index 427024f19..6b8c91925 100644 --- a/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +++ b/lib/pact_broker/webhooks/pact_and_verification_parameters.rb @@ -52,7 +52,7 @@ def to_hash PACT_URL => pact ? PactBroker::Api::PactBrokerUrls.pact_version_url_with_webhook_metadata(pact, base_url) : "", VERIFICATION_RESULT_URL => verification_url, CONSUMER_VERSION_NUMBER => consumer_version_number, - PROVIDER_VERSION_NUMBER => verification ? verification.provider_version_number : "", + PROVIDER_VERSION_NUMBER => provider_version_number, PROVIDER_VERSION_TAGS => provider_version_tags, PROVIDER_VERSION_BRANCH => provider_version_branch, CONSUMER_VERSION_TAGS => consumer_version_tags, @@ -146,6 +146,14 @@ def provider_version_tags end end + def provider_version_number + if webhook_context[:provider_version_number] + webhook_context[:provider_version_number] + else + verification ? verification.provider_version_number : "" + end + end + def provider_version_branch if webhook_context[:provider_version_branch] webhook_context[:provider_version_branch]