From 7cea5a2150ae31d9b661517e355c6f2fbccb7b38 Mon Sep 17 00:00:00 2001 From: zach Date: Mon, 7 Oct 2024 15:43:50 -0700 Subject: [PATCH] ci: more tweaks --- install.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index bd30af0..66dc815 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,15 @@ #!/bin/bash -# set -eou pipefail +set -eou pipefail + +if [[ -z "${GITHUB_TOKEN}" ]]; then + GITHUB_FLAGS="" +else + GITHUB_FLAGS="--header \"Authorization: Bearer $GITHUB_TOKEN\" --header \"X-GitHub-Api-Version: 2022-11-28\"" +fi # Get the latest release RELEASE_API_URL="https://api.github.com/repos/extism/python-pdk/releases/latest" -response=$(curl -s "$RELEASE_API_URL") +response=$(curl $GITHUB_FLAGS -s "$RELEASE_API_URL") if [ -z "$response" ]; then echo "Error: Failed to fetch the latest release from GitHub API." exit 1 @@ -114,8 +120,8 @@ if curl -fsSL --output /tmp/extism-py.tar.gz "$DOWNLOAD_URL"; then tar xzf /tmp/extism-py.tar.gz -C /tmp if [ "$USE_SUDO" = "1" ]; then - sudo mkdir -p /usr/local/share echo "No user-writable bin directory found in PATH. Using sudo to install in $INSTALL_DIR" + sudo mkdir -p /usr/local/share sudo rm -rf /usr/local/share/extism-py sudo mv /tmp/extism-py/bin/extism-py "$TARGET" sudo mv /tmp/extism-py/share/extism-py /usr/local/share