Skip to content

Commit a7b9f3c

Browse files
authored
Eradicate auth_flag
`curl` seems to be unhappy with spaces within this env var, resulting in curl: (22) The requested URL returned error: 400 Bad Request As unsightly as it is, we resort to explicitly setting the flag the way curl expects
1 parent 0ca05c2 commit a7b9f3c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

bin/compile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@ function fetch_pear() {
99
max_tries=10
1010
sleep_interval=180
1111

12-
if [ -n $GITHUB_TOKEN ]; then
13-
auth_flag="-H 'Authorization: token $GITHUB_TOKEN'"
14-
fi
15-
1612
while [[ $tries -le $max_tries ]]; do
1713
echo "Try $tries of $max_tries"
1814
if [ -z $version ]; then
19-
version=$(curl -sSfL --retry 20 "${auth_flag}" https://api.github.com/repos/pear/pearweb_phars/releases/latest | jq -r .tag_name)
15+
if [ -n $GITHUB_TOKEN ]; then
16+
version=$(curl -sSfL --retry 20 -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/pear/pearweb_phars/releases/latest | jq -r .tag_name)
17+
else
18+
version=$(curl -sSfL --retry 20 https://api.github.com/repos/pear/pearweb_phars/releases/latest | jq -r .tag_name)
19+
fi
2020
fi
2121

22-
curl -sSfL "${auth_flag}" --retry 20 -O https://raw.githubusercontent.com/pear/pearweb_phars/${version}/go-pear.phar
22+
if [ -n $GITHUB_TOKEN ]; then
23+
curl -sSfL -H "Authorization: token $GITHUB_TOKEN" --retry 20 -O https://raw.githubusercontent.com/pear/pearweb_phars/${version}/go-pear.phar
24+
else
25+
curl -sSfL --retry 20 -O https://raw.githubusercontent.com/pear/pearweb_phars/${version}/go-pear.phar
26+
fi
2327

2428
if [ -f go-pear.phar ]; then
2529
break

0 commit comments

Comments
 (0)