Skip to content

Commit 177949d

Browse files
committed
fix: make release script check runs by commit SHA for reliability
1 parent 2bf0d9f commit 177949d

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

release_script.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,30 @@ echo "-----------------------------------------------------"
77
VERSION=$(grep -m 1 '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
88
TAG="v$VERSION"
99

10-
echo "Waiting for Github Actions to complete for branch $TAG..."
10+
SHA=$(git rev-parse "$TAG")
11+
12+
echo "Waiting for Github Actions to register runs for commit $SHA ($TAG)..."
13+
while true; do
14+
TOTAL_RUNS=$(gh run list --commit "$SHA" --json status -q 'length')
15+
if [ "$TOTAL_RUNS" -gt 0 ]; then
16+
break
17+
fi
18+
echo "Waiting for runs to start..."
19+
sleep 5
20+
done
21+
22+
echo "Waiting for Github Actions to complete for commit $SHA..."
1123
while true; do
12-
ACTIVE_RUNS=$(gh run list --branch "$TAG" --json status -q 'map(select(.status != "completed")) | length')
24+
ACTIVE_RUNS=$(gh run list --commit "$SHA" --json status -q 'map(select(.status != "completed")) | length')
1325
if [ "$ACTIVE_RUNS" -eq 0 ]; then
1426
break
1527
fi
1628
echo "Still running: $ACTIVE_RUNS workflows active..."
1729
sleep 10
1830
done
1931

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')
32+
TOTAL_RUNS=$(gh run list --commit "$SHA" --json conclusion -q 'length')
33+
SUCCESS_RUNS=$(gh run list --commit "$SHA" --json conclusion -q 'map(select(.conclusion == "success")) | length')
2234

2335
if [ "$SUCCESS_RUNS" -eq "$TOTAL_RUNS" ] && [ "$TOTAL_RUNS" -gt 0 ]; then
2436
echo "CI pipeline completed successfully."

0 commit comments

Comments
 (0)