Skip to content

Commit 7cd47a0

Browse files
authored
[CI] Auto-version update fix: match on PR num (#6275)
1 parent 3f8c981 commit 7cd47a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/auto-update/version-in-file.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,17 @@ body="Update $repo version to \`$latest_version\`.
8686
See https://github.com/open-telemetry/$repo/releases/tag/$latest_version."
8787
branch="opentelemetrybot/auto-update-$repo-$latest_version"
8888

89+
echo "Looking for existing PRs with branch '$branch'."
8990
existing_pr_all=$(gh pr list --state all --head "$branch")
90-
existing_pr_count=$(echo "$existing_pr_all" | wc -l)
91-
if [ "$existing_pr_count" -gt 0 ]; then
91+
# `gh pr list` is a list of PRs, each line starting with a PR number if there's
92+
# a match. Otherwise returns "no ... matches". Test for PR number:
93+
if [[ "$existing_pr_all" =~ ^[0-9] ]]; then
9294
echo "PR(s) already exist for '$message':"
9395
echo $existing_pr_all
9496
echo "So we won't create another. Exiting."
9597
exit 0
98+
else
99+
echo "None found."
96100
fi
97101

98102
if [[ "$repo" == "opentelemetry-specification"

0 commit comments

Comments
 (0)