Skip to content

Commit

Permalink
try to auth to github API if avail 1
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Jul 12, 2024
1 parent 694faad commit 9f8bd4e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions _dl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,18 @@ EOF
}

my_curl() {
# >&2 echo "my_curl|$*|"
curl --disable --user-agent '' --fail --silent --show-error --globoff \
--remote-time --xattr \
--connect-timeout 15 --max-time 60 --retry 3 --max-redirs 10 "$@"
local opts
opts=(--disable --user-agent '' --fail --silent --show-error --globoff \
--remote-time --xattr \
--connect-timeout 15 --max-time 60 --retry 3 --max-redirs 10)
>&2 echo "my_curl|${opts[*]} $*|"
if [[ "$*" = *'https://api.github.com/'* && -n "${GITHUB_TOKEN:+1}" ]]; then
opts+=(--header @/dev/stdin)
exec <<EOF
Authorization: Bearer ${GITHUB_TOKEN}
EOF
fi
curl "${opts[@]}" "$@"
}

my_gpg() {
Expand Down

0 comments on commit 9f8bd4e

Please sign in to comment.