2929logger = logging .getLogger (__name__ )
3030
3131DEFAULT_JOB = 'ci_launcher'
32- REPOS_URL = 'https://raw.githubusercontent.com/ros2/ros2/{}/ros2.repos'
32+ ROS2_REPO = 'ros2/ros2'
33+ ROS2_REPOS_FILE = 'ros2.repos'
3334DEFAULT_TARGET = 'rolling'
3435CI_SERVER = 'https://ci.ros2.org'
3536SERVER_RETRIES = 2
@@ -55,14 +56,11 @@ def panic(msg: str) -> None:
5556 raise RuntimeError ('Panic: ' + msg )
5657
5758
58- def fetch_repos (target_release : str ) -> dict :
59+ def fetch_repos (github_instance : Github , target_release : str ) -> dict :
5960 """Fetch the repos file for the specific release."""
60- branch = target_release
61- if branch == 'rolling' :
62- branch = 'master'
63- repos_response = requests .get (REPOS_URL .format (branch ))
64-
65- repos_text = repos_response .text
61+ ros2_repo = github_instance .get_repo (ROS2_REPO )
62+ repos_file_contents = ros2_repo .get_contents (ROS2_REPOS_FILE , target_release )
63+ repos_text = repos_file_contents .decoded_content .decode ('utf-8' )
6664 toplevel_dict = yaml .safe_load (repos_text )
6765 return toplevel_dict ['repositories' ]
6866
@@ -74,7 +72,7 @@ def create_ci_gist(
7472) -> github .Gist .Gist :
7573 """Create gist for the list of pull requests."""
7674 logger .info ('Creating ros2.repos Gist for PRs' )
77- master_repos = fetch_repos (target_release )
75+ master_repos = fetch_repos (github_instance , target_release )
7876 shortnames = []
7977 for github_pr in pulls :
8078 pr_ref = github_pr .head .ref
0 commit comments