diff options
-rw-r--r-- | azure-pipelines.yml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ea6ad8b..bfd132f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -52,13 +52,13 @@ jobs: RESPONSE="$(curl -sSL "${REQUEST_URL}")" if [[ $BUILD_REASON = "PullRequest" ]]; then - PREV_COMMIT="$(echo "${RESPONSE}" | grep -Po '"pr.sourceSha":"\K.*?[^\\](?=",)')" + PREV_COMMIT="$(echo "${RESPONSE}" | grep -Po '"pr\.sourceSha"\s*:\s*"\K.*?[^\\](?="\s*[,}])')" if [[ -z $PREV_COMMIT ]]; then echo "Could not retrieve the previous build's commit. Falling back to the head of the target branch." PREV_COMMIT="origin/$SYSTEM_PULLREQUEST_TARGETBRANCH" fi else - PREV_COMMIT="$(echo "${RESPONSE}" | grep -Po '"sourceVersion":"\K.*?[^\\](?=",)')" + PREV_COMMIT="$(echo "${RESPONSE}" | grep -Po '"sourceVersion"\s*:\s*"\K.*?[^\\](?="\s*[,}])')" fi if [[ -n $PREV_COMMIT ]]; then |