Skip to content

Commit 6bf0b5a

Browse files
committed
Fix wait-for-hydra: redirect debug echo to stderr
The debug echo inside poll_github() was captured by the command substitution `conclusion=$(poll_github)`, making `conclusion` a multi-line string that never matched the `success)` or `failure)` patterns in the case statement. This caused the action to always fall through to the `*` wildcard and wait until timeout. Redirect both debug echo lines to stderr (`>&2`) so only the actual gh api result is captured in the return value.
1 parent ad6f50c commit 6bf0b5a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wait-for-hydra/support/wait.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ check_timeout() {
4949

5050
poll_github() {
5151
if [ -n "$CHECK" ]; then
52-
echo "Querying: gh api repos/$GITHUB_REPOSITORY/commits/$RELEVANT_SHA/check-runs --paginate --jq '...select(.name == \"$CHECK\")...'"
52+
# Debug output to stderr so it doesn't pollute the captured result.
53+
echo "Querying: gh api repos/$GITHUB_REPOSITORY/commits/$RELEVANT_SHA/check-runs --paginate --jq '...select(.name == \"$CHECK\")...'" >&2
5354
# Use tail -1 to handle paginated results that may concatenate
5455
# multiple values; take the last (most recent) non-empty line.
5556
gh api "repos/$GITHUB_REPOSITORY/commits/$RELEVANT_SHA/check-runs" \
5657
--paginate \
5758
--jq ".check_runs[] | select(.name == \"$CHECK\") | .conclusion" \
5859
| tail -1
5960
else
60-
echo "Querying: gh api repos/$GITHUB_REPOSITORY/commits/$RELEVANT_SHA/status --paginate --jq '...select(.context == \"$STATUS\")...'"
61+
# Debug output to stderr so it doesn't pollute the captured result.
62+
echo "Querying: gh api repos/$GITHUB_REPOSITORY/commits/$RELEVANT_SHA/status --paginate --jq '...select(.context == \"$STATUS\")...'" >&2
6163
gh api "repos/$GITHUB_REPOSITORY/commits/$RELEVANT_SHA/status" \
6264
--paginate \
6365
--jq ".statuses[] | select(.context == \"$STATUS\") | .state" \

0 commit comments

Comments
 (0)