Skip to content

Commit efca565

Browse files
committed
Add retry with backoff for npm install in Bun Compile workflow
npm registry propagation can take time after publish, causing the repository_dispatch-triggered workflow to fail when bun tries to install a version that hasn't propagated yet. Adds a retry loop (5 attempts, 30s backoff) to handle this race condition gracefully.
1 parent 57b1beb commit efca565

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/workflows/bun-compile.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,23 @@ jobs:
5252
echo "::error::No version provided. Supply via workflow_dispatch input or repository_dispatch payload."
5353
exit 1
5454
fi
55-
bun install "@augmentcode/auggie@${VERSION}"
55+
# Retry with backoff — npm registry may not have propagated the version yet
56+
# when triggered immediately via repository_dispatch on publish.
57+
max_attempts=5
58+
for attempt in $(seq 1 $max_attempts); do
59+
echo "Attempt $attempt/$max_attempts: installing @augmentcode/auggie@${VERSION}"
60+
if bun install "@augmentcode/auggie@${VERSION}"; then
61+
echo "Successfully installed on attempt $attempt"
62+
exit 0
63+
fi
64+
if [ "$attempt" -lt "$max_attempts" ]; then
65+
delay=$((attempt * 30))
66+
echo "Install failed, retrying in ${delay}s..."
67+
sleep "$delay"
68+
fi
69+
done
70+
echo "::error::Failed to install @augmentcode/auggie@${VERSION} after $max_attempts attempts"
71+
exit 1
5672
5773
- name: Create entry point
5874
run: |

0 commit comments

Comments
 (0)