diff options
| author | 2019-05-12 21:27:47 -0700 | |
|---|---|---|
| committer | 2019-05-12 21:29:52 -0700 | |
| commit | d3ebab35364e1c574acce3c8fe4a363dcacbe6c8 (patch) | |
| tree | e2b0b95e84ac0c01e61692e85c35d7191befcdf4 | |
| parent | Use eq() function in conditions instead of relying on casts (diff) | |
Make the JSON regex more robust
| -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 | 
