From 31a4064fbe636a6bd1d91744c90d3f31fe6498c5 Mon Sep 17 00:00:00 2001 From: Binlogo Date: Tue, 8 Jul 2025 21:30:27 +0800 Subject: [PATCH 1/2] feat: enhance get-extism.sh with GITHUB_TOKEN support and error handling for API rate limits --- scripts/get-extism.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/get-extism.sh b/scripts/get-extism.sh index 65423a2..df3cc72 100755 --- a/scripts/get-extism.sh +++ b/scripts/get-extism.sh @@ -26,10 +26,15 @@ usage() { echo " -o: installation prefix (default: /usr/local/bin)" echo " -y: accept defaults, don't ask before executing commands" echo " -g: build from source using go" + echo "" + echo "Environment Variables" + echo "---------------------" + echo " GITHUB_TOKEN: GitHub personal access token to avoid API rate limiting" } latest_tag() { - curl -s $latest_url | grep tag_name | awk '{ print $2 }' | sed 's/[",]//g' + curl -s ${GITHUB_TOKEN:+-H "Authorization: token $GITHUB_TOKEN"} $latest_url | + grep tag_name | awk '{ print $2 }' | sed 's/[",]//g' } untar() { @@ -134,6 +139,9 @@ esac if test -z "$version" then version="$(latest_tag)" + if [ $? -ne 0 ] || [ -z "$version" ]; then + err "Failed to fetch latest version from GitHub API (likely rate limited). Run with GITHUB_TOKEN env or try again later." + fi fi if [ "$ask" = "y" ] && [ ! -t 0 ]; then From 19e4c368f42a21151f200feee5d81a8fbb372917 Mon Sep 17 00:00:00 2001 From: Binlogo Date: Tue, 8 Jul 2025 22:38:32 +0800 Subject: [PATCH 2/2] chore: fix ci check get-excism.sh --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c11521..d0d20ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,8 @@ jobs: os: [ubuntu-latest, macos-latest] rust: - stable + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 - uses: ./.github/actions/extism-cli