Skip to content

Commit 7d35b6f

Browse files
committed
[ros1-setup] Use GITHUB_TOKEN when available
1 parent 9809ff3 commit 7d35b6f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ros1-setup/install.bash

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,19 @@ fi
2323
ros_apt_source_pkg_name="ros-apt-source"
2424

2525
installed_version=$(dpkg -s ${ros_apt_source_pkg_name} 2>/dev/null | grep -F "Version" | awk '{print $2}')
26-
newest_version=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}')
26+
27+
CURL_ARGS=("-H" "Accept: application/vnd.github+json")
28+
if [[ -n ${GITHUB_TOKEN} ]]
29+
then
30+
CURL_ARGS+=("-H" "Authorization: Bearer ${GITHUB_TOKEN}")
31+
fi
32+
newest_version=$(curl "${CURL_ARGS[@]}" -sL https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | jq -r '.tag_name')
33+
34+
if [[ ${newest_version} == "null" ]]
35+
then
36+
tue-install-error "Failed to get the newest version of '${ros_apt_source_pkg_name}'"
37+
fi
38+
2739
needs_install=true
2840
if [[ -n ${installed_version} ]]
2941
then

0 commit comments

Comments
 (0)