From 606ce518f5accb0ac6271d442be09b61254a562f Mon Sep 17 00:00:00 2001 From: Anthony Lucillo Date: Thu, 31 Jan 2019 15:32:31 -0500 Subject: [PATCH 1/2] Fix quotation issue --- assets/check | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/check b/assets/check index 9e6ead8..b8da6df 100755 --- a/assets/check +++ b/assets/check @@ -48,7 +48,7 @@ if [[ "$bitbucket_type" == "server" ]]; then id: .id | tostring, title: .title | tostring, branch: .fromRef.id | tostring | (capture("refs/heads/(?.+)").branch // .), - commit: .fromRef.latestCommit, + commit: .fromRef.latestCommit, updated_at: .updatedDate | tostring }) | map(select(if .title | test("wip"; "i") then false else true end)) @@ -74,8 +74,8 @@ elif [[ "$bitbucket_type" == "cloud" ]]; then # get the commit date, which is when the PR last got updated code-wise. # the updated_on field in the PR also changes when comment added etc - date=$(curl -s --fail -u "${username}:${password}" $commit_url | jq -r '.date') - + date=$(curl -s --fail -u "${username}:${password}" $commit_url | jq -r '.date') + prs+="+ [{id:\"$id\", title: \"$title\", branch: \"$branch\", commit:\"$commit\", updated_at:\"$date\"}]" done < <(jq -c '.[]' "${response}") @@ -86,7 +86,7 @@ elif [[ "$bitbucket_type" == "cloud" ]]; then # take the list of PRs | filter out containing "wip" in title | sort by update-date of commits | remove the date | pick latest PR, wrap as array for concourse jq -n "[ $prs - | map(select(if .title | test('wip'; 'i') then false else true end)) + | map(select(if .title | test(\"wip\"; \"i\") then false else true end)) | sort_by(.updated_at) | map(del(.updated_at)) | .[-1] ]" >&3 From da25ebe002aa37af3b33cbc14711c3f350606690 Mon Sep 17 00:00:00 2001 From: Anthony Lucillo Date: Mon, 4 Feb 2019 10:09:18 -0500 Subject: [PATCH 2/2] Quotation change as requested. --- assets/check | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/check b/assets/check index b8da6df..1d3e2ef 100755 --- a/assets/check +++ b/assets/check @@ -85,10 +85,10 @@ elif [[ "$bitbucket_type" == "cloud" ]]; then fi # take the list of PRs | filter out containing "wip" in title | sort by update-date of commits | remove the date | pick latest PR, wrap as array for concourse - jq -n "[ $prs - | map(select(if .title | test(\"wip\"; \"i\") then false else true end)) + jq --argjson prlist "$(jq -n "$prs")" -n '[ $prlist + | map(select(if .title | test("wip"; "i") then false else true end)) | sort_by(.updated_at) | map(del(.updated_at)) - | .[-1] ]" >&3 + | .[-1] ]' >&3 fi