Skip to content

Commit f8fb3ba

Browse files
committed
fix: correct syntax for jq command
1 parent 38eba9d commit f8fb3ba

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

external/googleapis/renovate.sh

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ BRANCH="master"
4747
if [[ -z "${COMMIT}" ]]; then
4848
COMMIT=$(curl -fsSL -H "Accept: application/vnd.github.VERSION.sha" \
4949
"https://api.github.com/repos/${REPO}/commits/${BRANCH}")
50+
echo "${COMMIT}"
5051
fi
5152

5253
if [[ -z "$COMMIT_DATE" ]]; then
@@ -104,44 +105,43 @@ if git diff --quiet bazel/workspace0.bzl \
104105
exit 0
105106
fi
106107

107-
#banner "Regenerating libraries"
108-
## generate-libraries fails if it creates a diff, so ignore its status.
109-
#TRIGGER_TYPE='pr' ci/cloudbuild/build.sh \
110-
#--docker --trigger=generate-libraries-pr || true
111-
#
112-
#banner "Creating commits"
113-
#git commit -m"chore: update googleapis SHA circa ${COMMIT_DATE}" \
114-
#${PIPERORIGIN_REVID:+-m "${PIPERORIGIN_REVID}"} \
115-
#bazel/workspace0.bzl cmake/GoogleapisConfig.cmake MODULE.bazel
116-
#if ! git diff --quiet external/googleapis/protodeps \
117-
#external/googleapis/protolists; then
118-
#git commit -m"Update the protodeps/protolists" \
119-
#external/googleapis/protodeps external/googleapis/protolists
120-
#fi
121-
#if ! git diff --quiet .; then
122-
#git commit -m"Regenerate libraries" .
123-
#fi
124-
#
125-
#banner "Showing git state"
126-
#git status --untracked-files=no
127-
#echo ""
128-
#git show-branch
129-
#
108+
banner "Regenerating libraries"
109+
# generate-libraries fails if it creates a diff, so ignore its status.
110+
TRIGGER_TYPE='pr' ci/cloudbuild/build.sh \
111+
--docker --trigger=generate-libraries-pr || true
112+
113+
banner "Creating commits"
114+
git commit -m"chore: update googleapis SHA circa ${COMMIT_DATE}" \
115+
${PIPERORIGIN_REVID:+-m "${PIPERORIGIN_REVID}"} \
116+
bazel/workspace0.bzl cmake/GoogleapisConfig.cmake MODULE.bazel
117+
if ! git diff --quiet external/googleapis/protodeps \
118+
external/googleapis/protolists; then
119+
git commit -m"Update the protodeps/protolists" \
120+
external/googleapis/protodeps external/googleapis/protolists
121+
fi
122+
if ! git diff --quiet .; then
123+
git commit -m"Regenerate libraries" .
124+
fi
125+
126+
banner "Showing git state"
127+
git status --untracked-files=no
128+
echo ""
129+
git show-branch
130+
130131
banner "Creating tag in ${REPO}"
131132
TAG="${TAG:-0.0.0-$(date +"%Y%m%d")-${COMMIT:0:8}}"
132-
#tag_googleapis
133+
tag_googleapis
133134

134135
banner "Confirming presence of generated googleapis module in bazel-central-registry"
135136
JSON=$(gh search prs --repo=bazelbuild/bazel-central-registry --state=open --match=title "Publish googleapis@${TAG}" --json=url,title --order=desc)
136137

137138
function filter_json() {
138-
set -x
139-
jq -r --arg tag "${TAG}" '.[] | select(.title | test('\"'$tag'\"'))' <<< $"{json}"
139+
jq -r --arg tag "${TAG}" '.[] | select(.title | test("'$TAG'"))' <<< "${JSON}"
140140
}
141141

142142
while true; do
143143
FILTERED_JSON=$(filter_json)
144-
if -n "${FILTERED_JSON}"; then
144+
if [[ -n "${FILTERED_JSON}" ]]; then
145145
URL=$(jq '.url' <<< "${FILTERED_JSON}")
146146
echo
147147
banner "Found PR with new googleapis module in bazel-centra-registry: ${URL}"

0 commit comments

Comments
 (0)