Skip to content

Commit 43e0ae1

Browse files
committed
[CI] Use repo_name as cross-PR lookup rather than id
Rather than using the repo id (org/repository) to find the cross-PR testing branch, instead use the repo name. This is less likely to fail during the migration of `apple` -> `swiftlang` as it does not rely on updating the `update-checkout` config with the new repository id.
1 parent 517667e commit 43e0ae1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ def get_branch_for_repo(config, repo_name, scheme_name, scheme_map,
131131
if scheme_map:
132132
scheme_branch = scheme_map[repo_name]
133133
repo_branch = scheme_branch
134-
remote_repo_id = config['repos'][repo_name]['remote']['id']
135-
if remote_repo_id in cross_repos_pr:
134+
if repo_name in cross_repos_pr:
136135
cross_repo = True
137-
pr_id = cross_repos_pr[remote_repo_id]
136+
pr_id = cross_repos_pr[repo_name]
138137
repo_branch = "ci_pr_{0}".format(pr_id)
139138
shell.run(["git", "checkout", scheme_branch],
140139
echo=True)
@@ -700,10 +699,7 @@ def main():
700699

701700
cross_repos_pr = {}
702701
if github_comment:
703-
regex_pr = r'(apple/[-a-zA-Z0-9_]+/pull/\d+'\
704-
r'|apple/[-a-zA-Z0-9_]+#\d+'\
705-
r'|swiftlang/[-a-zA-Z0-9_]+/pull/\d+'\
706-
r'|swiftlang/[-a-zA-Z0-9_]+#\d+)'
702+
regex_pr = r'(?:apple/|swiftlang/)([-a-zA-Z0-9_]+/pull/\d+|[-a-zA-Z0-9_]+#\d+)'
707703
repos_with_pr = re.findall(regex_pr, github_comment)
708704
print("Found related pull requests:", str(repos_with_pr))
709705
repos_with_pr = [pr.replace('/pull/', '#') for pr in repos_with_pr]

0 commit comments

Comments
 (0)