@@ -129,6 +129,7 @@ jobs:
129129 local id="$1"
130130 local cursor="$2"
131131
132+ # shellcheck disable=SC2016 # GraphQL variables use $, not shell expansion.
132133 gh api graphql -F workflowId="$id" -F after="$cursor" \
133134 -f query='query($workflowId: ID!, $after: String) {
134135 node(id: $workflowId) {
@@ -151,22 +152,31 @@ jobs:
151152 widths_name=30
152153 widths_count=14
153154 widths_total=12
154- widths_table=$(( $ widths_index + 3 + $ widths_name + 3 + $ widths_count + 3 + $ widths_total ))
155+ widths_table=$((widths_index + 3 + widths_name + 3 + widths_count + 3 + widths_total))
155156
156157 # Repeats a character a given number of times.
157158 repeat_char() {
158159 local char=$1
159160 local count=$2
160- printf "%0.s$char" $(seq 1 $count)
161+ local i
162+
163+ for ((i = 0; i < count; i++)); do
164+ printf "%s" "$char"
165+ done
161166 }
162167
163168 # Prints the given header as `==== <header> ====` to match the table layout.
164169 print_table_header() {
165170 local header="$1"
166171 local header_len=${#header}
167- local left_pad=$(( ( $widths_table - header_len - 2) / 2 ))
168- local right_pad=$(( $widths_table - header_len - 2 - left_pad ))
169- printf " \n%s %s %s\n" $(repeat_char = $left_pad) "$header" $(repeat_char = $right_pad)
172+ local left_pad=$(((widths_table - header_len - 2) / 2))
173+ local right_pad=$((widths_table - header_len - 2 - left_pad))
174+ local left_fill
175+ local right_fill
176+
177+ left_fill=$(repeat_char "=" "$left_pad")
178+ right_fill=$(repeat_char "=" "$right_pad")
179+ printf " \n%s %s %s\n" "$left_fill" "$header" "$right_fill"
170180 }
171181
172182 # Prints |---+---+---+---| with appropriate widths to accomodate the table headers.
@@ -251,9 +261,9 @@ jobs:
251261 print_table_row "[$index/$n_workflows]" "$name" "$count" "$total"
252262
253263 if [ "$MODE" = "execute" ]; then
254- for run_id in $run_ids ; do
264+ while IFS= read -r run_id ; do
255265 gh run delete "$run_id" >/dev/null
256- done
266+ done <<< "$run_ids"
257267 fi
258268
259269 [ "$has_next" != "true" ] && break
0 commit comments