Sha256: b3c35b9b54d96ba9c21dfd4d996b31460279eb8d7d6b8b028e70cb6837e5e113

Contents?: true

Size: 895 Bytes

Versions: 6

Compression:

Stored size: 895 Bytes

Contents

#!/bin/bash

set -Eeuo pipefail

echo "Deleting branch ${GIT_BRANCH} for ${PACTICIPANT} in Pactflow..."
ENCODED_GIT_BRANCH=$(echo "$GIT_BRANCH" | ruby -e "require 'erb'; puts ERB::Util.url_encode(ARGF.read.chomp)")
ENCODED_PACTICIPANT=$(echo "$PACTICIPANT" | ruby -e "require 'erb'; puts ERB::Util.url_encode(ARGF.read.chomp)")
BRANCH_URL="${PACT_BROKER_BASE_URL}/pacticipants/${ENCODED_PACTICIPANT}/branches/${ENCODED_GIT_BRANCH}"

output_file=$(mktemp)

status=$(curl -v -X DELETE "${BRANCH_URL}" -H "Authorization: Bearer ${PACT_BROKER_TOKEN}" 2>&1 | tee "${output_file}" | awk '/^< HTTP/{print $3}')

if [ "$status" = "404" ]; then
  echo "Branch ${GIT_BRANCH} for ${PACTICIPANT} does not exist in Pactflow"
elif [ $status -ge 400 ]; then
  cat "${output_file}"
  echo "Error deleting branch in Pactflow"
  exit 1
else
  echo "Deleted branch ${GIT_BRANCH} for ${PACTICIPANT} in Pactflow"
fi

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-client-1.77.0 script/ci/delete-branch-in-pactflow.sh
pact_broker-client-1.76.2 script/ci/delete-branch-in-pactflow.sh
pact_broker-client-1.76.1 script/ci/delete-branch-in-pactflow.sh
pact_broker-client-1.76.0 script/ci/delete-branch-in-pactflow.sh
pact_broker-client-1.75.4 script/ci/delete-branch-in-pactflow.sh
pact_broker-client-1.75.3 script/ci/delete-branch-in-pactflow.sh