Skip to content

Commit

Permalink
Merge pull request #21 from alucillo/fix-jq-error
Browse files Browse the repository at this point in the history
Fix quotation issue
  • Loading branch information
idr0id authored Feb 5, 2019
2 parents f21025f + da25ebe commit 7aa24fe
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions assets/check
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if [[ "$bitbucket_type" == "server" ]]; then
id: .id | tostring,
title: .title | tostring,
branch: .fromRef.id | tostring | (capture("refs/heads/(?<branch>.+)").branch // .),
commit: .fromRef.latestCommit,
commit: .fromRef.latestCommit,
updated_at: .updatedDate | tostring
})
| map(select(if .title | test("wip"; "i") then false else true end))
Expand All @@ -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}")

Expand All @@ -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

0 comments on commit 7aa24fe

Please sign in to comment.