Skip to content

Commit 17da140

Browse files
committed
Add GitHub token to api requests
1 parent b1bc2cf commit 17da140

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
set -xe
44

5+
if [ -z "${INPUT_GITHUB_TOKEN}" ] ; then
6+
echo "Consider setting a GITHUB_TOKEN to prevent GitHub api rate limits." >&2
7+
fi
8+
59
TFSEC_VERSION=""
610
if [ "$INPUT_TFSEC_VERSION" != "latest" ] && [ -n "$INPUT_TFSEC_VERSION" ]; then
711
TFSEC_VERSION="/tags/${INPUT_TFSEC_VERSION}"
@@ -23,6 +27,7 @@ function get_release_assets {
2327
-sSL
2428
--header "Accept: application/vnd.github+json"
2529
)
30+
[ -n "${INPUT_GITHUB_TOKEN}" ] && args+=(--header "Authorization: Bearer ${INPUT_GITHUB_TOKEN}")
2631
curl "${args[@]}" "https://api.github.com/repos/$repo/releases${version}" | jq '.assets[] | { name: .name, download_url: .browser_download_url }'
2732
}
2833

0 commit comments

Comments
 (0)