Skip to content

Commit 504785e

Browse files
committed
fix(ci): use gh CLI with auth for Caddy version and add fallback
- Use gh CLI with GH_TOKEN for authenticated GitHub API access - Add fallback version (2.9.1) if version detection fails - Prevents 404 errors from GitHub API rate limiting
1 parent 70dec48 commit 504785e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ jobs:
2626
otp-version: ${{ matrix.otp }}
2727

2828
- name: Download Caddy
29+
env:
30+
GH_TOKEN: ${{ github.token }}
2931
run: |
30-
CADDY_VERSION=$(curl -sL https://api.github.com/repos/caddyserver/caddy/releases/latest | jq -r '.tag_name' | sed 's/^v//')
32+
# Use GitHub CLI with authentication to avoid rate limits
33+
CADDY_VERSION=$(gh release view --repo caddyserver/caddy --json tagName -q '.tagName' | sed 's/^v//')
34+
if [ -z "$CADDY_VERSION" ] || [ "$CADDY_VERSION" = "null" ]; then
35+
echo "Failed to get latest version, using fallback"
36+
CADDY_VERSION="2.9.1"
37+
fi
3138
echo "Downloading Caddy version: $CADDY_VERSION"
3239
curl -fsSL "https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz" -o caddy.tar.gz
3340
tar -xzf caddy.tar.gz

0 commit comments

Comments
 (0)