Skip to content

Commit 53f26b3

Browse files
phorcys420mafredri
andauthored
fix(scripts): check if PR list is empty (coder#8805)
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
1 parent 612f1c6 commit 53f26b3

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

scripts/release/check_commit_metadata.sh

+13-9
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,20 @@ main() {
8282
--json mergeCommit,labels,author \
8383
--jq '.[] | "\( .mergeCommit.oid ) author:\( .author.login ) labels:\(["label:\( .labels[].name )"] | join(" "))"'
8484
)"
85-
mapfile -t pr_metadata_raw <<<"$pr_list_out"
85+
8686
declare -A authors labels
87-
for entry in "${pr_metadata_raw[@]}"; do
88-
commit_sha_long=${entry%% *}
89-
commit_author=${entry#* author:}
90-
commit_author=${commit_author%% *}
91-
authors[$commit_sha_long]=$commit_author
92-
all_labels=${entry#* labels:}
93-
labels[$commit_sha_long]=$all_labels
94-
done
87+
if [[ -n $pr_list_out ]]; then
88+
mapfile -t pr_metadata_raw <<<"$pr_list_out"
89+
90+
for entry in "${pr_metadata_raw[@]}"; do
91+
commit_sha_long=${entry%% *}
92+
commit_author=${entry#* author:}
93+
commit_author=${commit_author%% *}
94+
authors[$commit_sha_long]=$commit_author
95+
all_labels=${entry#* labels:}
96+
labels[$commit_sha_long]=$all_labels
97+
done
98+
fi
9599

96100
for commit in "${commits[@]}"; do
97101
mapfile -d ' ' -t parts <<<"$commit"

0 commit comments

Comments
 (0)