mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-25 01:23:22 +01:00
Use github token to read api (#1125)
prevent failing tests by using a github token to perform requests in our CI/CD
This commit is contained in:
parent
bb40325977
commit
bdb8383485
1
.github/workflows/install-script-test.yml
vendored
1
.github/workflows/install-script-test.yml
vendored
@ -27,6 +27,7 @@ jobs:
|
||||
env:
|
||||
SKIP_UI_APP: ${{ matrix.skip_ui_mode }}
|
||||
USE_BIN_INSTALL: ${{ matrix.install_binary }}
|
||||
GITHUB_TOKEN: ${{ secrets.RO_API_CALLER_TOKEN }}
|
||||
run: |
|
||||
[ "$SKIP_UI_APP" == "false" ] && export XDG_CURRENT_DESKTOP="none"
|
||||
cat release_files/install.sh | sh -x
|
||||
|
@ -19,8 +19,14 @@ PACKAGE_MANAGER="bin"
|
||||
INSTALL_DIR=""
|
||||
|
||||
get_latest_release() {
|
||||
if [ -n "$GITHUB_TOKEN" ]; then
|
||||
curl -H "Authorization: token ${GITHUB_TOKEN}" -s "https://api.github.com/repos/${OWNER}/${REPO}/releases/latest" \
|
||||
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
|
||||
else
|
||||
curl -s "https://api.github.com/repos/${OWNER}/${REPO}/releases/latest" \
|
||||
| grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
download_release_binary() {
|
||||
@ -45,7 +51,11 @@ download_release_binary() {
|
||||
DOWNLOAD_URL="${BASE_URL}/${VERSION}/${BINARY_NAME}"
|
||||
|
||||
echo "Installing $1 from $DOWNLOAD_URL"
|
||||
if [ -n "$GITHUB_TOKEN" ]; then
|
||||
cd /tmp && curl -H "Authorization: token ${GITHUB_TOKEN}" -LO "$DOWNLOAD_URL"
|
||||
else
|
||||
cd /tmp && curl -LO "$DOWNLOAD_URL"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$OS_TYPE" = "darwin" ] && [ "$1" = "$UI_APP" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user