Skip to content

Conversation

@kirillbilchenko
Copy link

Add a way to specify github token for downloading binaries, can pass workflow generated token

@jtyr
Copy link
Owner

jtyr commented Feb 12, 2024

Thanks for your PR, @kirillbilchenko. May I ask you why do you need to pass a GH token to download files from a public repo?

@kirillbilchenko
Copy link
Author

This one is useful if you are having nat, and for example multiple apps working with github api, so you will not rate limit for non auth calls.

@jtyr
Copy link
Owner

jtyr commented Mar 10, 2024

I see. What about to put something like this above the if [ $DOWNLOADER = 'curl' ]; then:

if [ -z "${GITHUB_TOKEN}" ]; then
  header="--header='Authorization: Bearer ${GITHUB_TOKEN}'"
fi

And then in each of the command just add it like this:

DOWNLOAD_URL=$(curl -sL "$header" "$latest_url" | grep "$OS-$ARCH" | awk '/"browser_download_url":/{gsub(/[,"]/,"", $2); print $2}' 2>/dev/null)
PROJECT_CHECKSUM=$(curl -sL "$header" "$latest_url" | grep "$PROJECT_CHECKSUM_FILE" | awk '/"browser_download_url":/{gsub(/[,"]/,"", $2); print $2}' 2>/dev/null)

That should help to reduce the code redundancy a little bit.

@Hikariii
Copy link

I am seemingly having rate-limit issues with this plugin. If this solves the issue I would like to see this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants