mirror of
https://gitea.com/gitea/docs.git
synced 2026-09-17 19:55:34 +00:00
ci: keep the jq expressions parsable on jq 1.6
This commit is contained in:
@@ -27,16 +27,17 @@ gitea_api() {
|
||||
curl "${args[@]}" "$url"
|
||||
}
|
||||
|
||||
label_id="$(gitea_api GET "$API/labels?limit=100" | jq -r --arg label "$LABEL" \
|
||||
'.[] | select(.name == $label) | .id')"
|
||||
# see the note in check-upstream-deps.sh about the argument name
|
||||
label_id="$(gitea_api GET "$API/labels?limit=100" | jq -r --arg want "$LABEL" \
|
||||
'.[] | select(.name == $want) | .id')"
|
||||
if [ -z "$label_id" ]; then
|
||||
echo "the repository has no \"$LABEL\" label, nothing to do"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pulls="$(gitea_api GET "$API/pulls?state=open&limit=50")"
|
||||
indexes="$(printf '%s' "$pulls" | jq -r --arg label "$LABEL" \
|
||||
'.[] | select([.labels[]?.name] | index($label) != null) | .number')"
|
||||
indexes="$(printf '%s' "$pulls" | jq -r --arg want "$LABEL" \
|
||||
'.[] | select([(.labels // [])[].name] | index($want) != null) | .number')"
|
||||
|
||||
if [ -z "$indexes" ]; then
|
||||
echo "no open pull request carries the \"$LABEL\" label"
|
||||
|
||||
Reference in New Issue
Block a user