Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9953d9b

Browse files
committed
Add automatic release watching
1 parent 7055b1d commit 9953d9b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

scripts/release.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,28 @@ gh workflow run release.yaml \
152152
-F snapshot=false \
153153
"${args[@]}"
154154

155-
log "Release process started, you can watch the release via: gh run watch --exit-status <run-id>"
155+
read -p "Watch release? (y/n)" -n 1 -r watch
156+
if ! [[ $watch =~ ^[Yy]$ ]]; then
157+
exit 0
158+
fi
159+
160+
log 'Waiting for job to become "in_progress"...'
161+
162+
# Wait at most 3 minutes (3*60)/3 = 60 for the job to start.
163+
for _ in $(seq 1 60); do
164+
mapfile -t run < <(
165+
# 3886828508 in_progress
166+
gh run list -w release.yaml \
167+
--limit 1 \
168+
--json status,databaseId \
169+
--jq '.[] | (.databaseId | tostring) + " " + .status'
170+
)
171+
if [[ ${run[1]} != "in_progress" ]]; then
172+
sleep 3
173+
continue
174+
fi
175+
gh run watch --exit-status "${run[0]}"
176+
exit 0
177+
done
178+
179+
error "Waiting for job to start timed out."

0 commit comments

Comments
 (0)