Skip to content

Commit b315f69

Browse files
committed
fix: resolve race condition in release script workflow monitoring
1 parent dd3fce3 commit b315f69

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

release_script.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ TAG="v$VERSION"
99

1010
echo "Waiting for Github Actions to complete for branch $TAG..."
1111
while true; do
12-
STATUS=$(gh run list --branch "$TAG" --json status,conclusion -q '.[0].status')
13-
CONCLUSION=$(gh run list --branch "$TAG" --json status,conclusion -q '.[0].conclusion')
14-
if [ "$STATUS" == "completed" ]; then
12+
ACTIVE_RUNS=$(gh run list --branch "$TAG" --json status -q 'map(select(.status != "completed")) | length')
13+
if [ "$ACTIVE_RUNS" -eq 0 ]; then
1514
break
1615
fi
16+
echo "Still running: $ACTIVE_RUNS workflows active..."
1717
sleep 10
1818
done
1919

20-
if [ "$CONCLUSION" == "success" ]; then
20+
TOTAL_RUNS=$(gh run list --branch "$TAG" --json conclusion -q 'length')
21+
SUCCESS_RUNS=$(gh run list --branch "$TAG" --json conclusion -q 'map(select(.conclusion == "success")) | length')
22+
23+
if [ "$SUCCESS_RUNS" -eq "$TOTAL_RUNS" ] && [ "$TOTAL_RUNS" -gt 0 ]; then
2124
echo "CI pipeline completed successfully."
2225

2326
echo "Cleaning old artifact directories..."

0 commit comments

Comments
 (0)