Skip to content

Commit f9949ac

Browse files
authored
fix: avoid stale gh run watch in RC release script (#712)
Allow release_rc.sh to resume from an existing GitHub Actions run by setting RELEASE_RUN_ID, and add RELEASE_WATCH=0 to poll run/job status with plain gh run view output instead of gh run watch. This avoids getting stuck on stale gh run watch terminal output while keeping the default release flow unchanged.
1 parent c0e6e86 commit f9949ac

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

dev/release/release_rc.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ rc=$2
4444
: "${RELEASE_PUSH_TAG:=${RELEASE_DEFAULT}}"
4545
: "${RELEASE_SIGN:=${RELEASE_DEFAULT}}"
4646
: "${RELEASE_UPLOAD:=${RELEASE_DEFAULT}}"
47+
: "${RELEASE_WATCH:=${RELEASE_DEFAULT}}"
48+
: "${RELEASE_WATCH_INTERVAL:=30}"
4749

4850
cd "${SOURCE_TOP_DIR}"
4951

@@ -81,7 +83,7 @@ if [ "${RELEASE_SIGN}" -gt 0 ]; then
8183
repository="${repository%.git}"
8284

8385
echo "Looking for GitHub Actions workflow on ${repository}:${rc_tag}"
84-
run_id=""
86+
run_id="${RELEASE_RUN_ID:-}"
8587
while [ -z "${run_id}" ]; do
8688
echo "Waiting for run to start..."
8789
run_id=$(gh run list \
@@ -93,7 +95,33 @@ if [ "${RELEASE_SIGN}" -gt 0 ]; then
9395
done
9496

9597
echo "Found GitHub Actions workflow with ID: ${run_id}"
96-
gh run watch --repo "${repository}" --exit-status "${run_id}"
98+
if [ "${RELEASE_WATCH}" -gt 0 ]; then
99+
gh run watch --repo "${repository}" --exit-status "${run_id}"
100+
else
101+
while true; do
102+
run_status=$(gh run view \
103+
--repo "${repository}" \
104+
--json 'status,conclusion' \
105+
--jq '.status + " " + (.conclusion // "")' \
106+
"${run_id}")
107+
echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ') GitHub Actions workflow status: ${run_status}"
108+
gh run view \
109+
--repo "${repository}" \
110+
--json jobs \
111+
--jq '.jobs[] | " " + .name + ": " + .status + " " + (.conclusion // "")' \
112+
"${run_id}"
113+
case "${run_status}" in
114+
"completed success")
115+
break
116+
;;
117+
completed\ *)
118+
echo "GitHub Actions workflow did not complete successfully: ${run_status}"
119+
exit 1
120+
;;
121+
esac
122+
sleep "${RELEASE_WATCH_INTERVAL}"
123+
done
124+
fi
97125

98126
mkdir -p "${rc_id}"
99127

0 commit comments

Comments
 (0)