diff --git a/ci/scripts/utils/githubpr.py b/ci/scripts/utils/githubpr.py index 5fe0b643ea..bd0e4a708e 100755 --- a/ci/scripts/utils/githubpr.py +++ b/ci/scripts/utils/githubpr.py @@ -56,7 +56,12 @@ def __init__(self, repo_url=None, TOKEN=None): if TOKEN is None: gh_cli = which('gh') gh_cli.add_default_arg(['auth', 'status', '--show-token']) - TOKEN = gh_cli(output=str, error=str).split('\n')[3].split(': ')[1] + gh_output = gh_cli(output=str, error=str) + token_match = re.search(r"Token:\s*([a-zA-Z0-9_]+)", gh_output) + if token_match: + TOKEN = token_match.group(1) + else: + raise ValueError("Token not found in gh CLI output.") super().__init__(TOKEN) self.repo = self.get_repo_url(repo_url)