From 3a5c161114888121ef0e822af8fd6461143ab1a6 Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Wed, 16 Jul 2025 10:37:38 +0200 Subject: [PATCH 1/4] Fix GH API rate limits We used to curl GH's API, now we use `gh` and revert to `curl` if `gh` is not in PATH. --- action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 47659d7..754a491 100644 --- a/action.yml +++ b/action.yml @@ -25,7 +25,11 @@ runs: VARIANT="Linux-x86_64" # Find download URL for the Linux build - URL=$(curl --retry 5 -sL "https://api.github.com/repos/FStarLang/FStar/releases/tags/$FSTAR" | jq '.assets.[] | .browser_download_url | select(contains("Linux"))' -r) + URL=$( + ( gh release view "$FSTAR" --repo FStarLang/FStar --json assets || \ + curl --retry 5 -sL "https://api.github.com/repos/FStarLang/FStar/releases/tags/$FSTAR" ) \ + | jq '.assets.[] | (.url // .browser_download_url) | select(contains("Linux"))' -r + ) # Download echo "Trying to download $URL" curl -sL "$URL" -o fstar.tar.gz From 445833aac7949dd9555cdaf9416b8c61ce67dc0b Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Wed, 16 Jul 2025 10:47:08 +0200 Subject: [PATCH 2/4] Update action.yml --- action.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 754a491..85fdd8f 100644 --- a/action.yml +++ b/action.yml @@ -25,11 +25,20 @@ runs: VARIANT="Linux-x86_64" # Find download URL for the Linux build - URL=$( - ( gh release view "$FSTAR" --repo FStarLang/FStar --json assets || \ - curl --retry 5 -sL "https://api.github.com/repos/FStarLang/FStar/releases/tags/$FSTAR" ) \ - | jq '.assets.[] | (.url // .browser_download_url) | select(contains("Linux"))' -r - ) + if [[ -z "$GH_TOKEN" || ! $(command -v gh) ]]; then + echo -e "\033[0;31mWARNING: fallback from `gh` to `curl`. You may hit API rate limits.\033[0m" + if [[ ! $(command -v gh) ]]; then + echo -e "\033[0;31m Command `gh` not found.\033[0m" + fi + if [[ -z "$GH_TOKEN" ]]; then + echo -e "\033[0;31m `GH_TOKEN` is not set.\033[0m" + echo -e "\033[0;31m To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable.:\033[0m" + fi + ASSETS=$(gh release view "$FSTAR" --repo FStarLang/FStar --json assets) + else + ASSETS=$(curl --retry 5 -sL "https://api.github.com/repos/FStarLang/FStar/releases/tags/$FSTAR" )) + fi + URL=$(echo "$ASSETS" | jq '.assets.[] | (.url // .browser_download_url) | select(contains("Linux"))' -r) # Download echo "Trying to download $URL" curl -sL "$URL" -o fstar.tar.gz From 89a7d776959dd41e2baaf270aa289d12036f4146 Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Wed, 16 Jul 2025 10:47:57 +0200 Subject: [PATCH 3/4] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 85fdd8f..0835aa6 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ runs: fi ASSETS=$(gh release view "$FSTAR" --repo FStarLang/FStar --json assets) else - ASSETS=$(curl --retry 5 -sL "https://api.github.com/repos/FStarLang/FStar/releases/tags/$FSTAR" )) + ASSETS=$(curl --retry 5 -sL "https://api.github.com/repos/FStarLang/FStar/releases/tags/$FSTAR") fi URL=$(echo "$ASSETS" | jq '.assets.[] | (.url // .browser_download_url) | select(contains("Linux"))' -r) # Download From 3b8b319d49094e2269fc58fa42c86b9b462cc275 Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Wed, 16 Jul 2025 10:49:06 +0200 Subject: [PATCH 4/4] Update action.yml --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 0835aa6..98b703a 100644 --- a/action.yml +++ b/action.yml @@ -26,12 +26,12 @@ runs: # Find download URL for the Linux build if [[ -z "$GH_TOKEN" || ! $(command -v gh) ]]; then - echo -e "\033[0;31mWARNING: fallback from `gh` to `curl`. You may hit API rate limits.\033[0m" + echo -e "\033[0;31mWARNING: fallback from [gh] to [curl]. You may hit API rate limits.\033[0m" if [[ ! $(command -v gh) ]]; then - echo -e "\033[0;31m Command `gh` not found.\033[0m" + echo -e "\033[0;31m Command [gh] not found.\033[0m" fi if [[ -z "$GH_TOKEN" ]]; then - echo -e "\033[0;31m `GH_TOKEN` is not set.\033[0m" + echo -e "\033[0;31m [GH_TOKEN] is not set.\033[0m" echo -e "\033[0;31m To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable.:\033[0m" fi ASSETS=$(gh release view "$FSTAR" --repo FStarLang/FStar --json assets)