Skip to content

Commit

Permalink
Updates latest-dagger-version.sh script.
Browse files Browse the repository at this point in the history
This CL updates `latest-dagger-version.sh` so that it can be easily run outside of GitHub Actions without a token.

RELNOTES=N/A
PiperOrigin-RevId: 528004661
  • Loading branch information
bcorso authored and Dagger Team committed Apr 28, 2023
1 parent 9858bf6 commit b2d0cab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions util/latest-dagger-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ set -eu

function github-rest-api {
local GITHUB_REST_API=$1

local GITHUB_API_HEADER_ACCEPT="Accept: application/vnd.github.v3+json"
# Grab the GH_TOKEN or else default to an empty string.
local GITHUB_TOKEN="${GH_TOKEN:-}"

if [ -z "$GH_TOKEN" ]; then
if [ -z "$GITHUB_TOKEN" ]; then
curl -s $GITHUB_REST_API -H $GITHUB_API_HEADER_ACCEPT
else
curl -s $GITHUB_REST_API \
-H $GITHUB_API_HEADER_ACCEPT \
-H "authorization: Bearer $GH_TOKEN"
-H "authorization: Bearer $GITHUB_TOKEN"
fi
}

Expand Down

0 comments on commit b2d0cab

Please sign in to comment.