Skip to content

Commit 1bde01d

Browse files
committed
Fix logic for repo used in sync pr
1 parent ee37956 commit 1bde01d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

easybuild/tools/github.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,11 +2190,12 @@ def det_account_branch_for_pr(pr_id, github_user=None, pr_target_repo=None):
21902190

21912191
# branch that corresponds with PR is supplied in form <account>:<branch_label>
21922192
account = pr_data['head']['label'].split(':')[0]
2193+
repo = pr_data['head']['repo']['name']
21932194
branch = ':'.join(pr_data['head']['label'].split(':')[1:])
21942195
github_target = '%s/%s' % (pr_target_account, pr_target_repo)
21952196
print_msg("Determined branch name corresponding to %s PR #%s: %s" % (github_target, pr_id, branch), log=_log)
21962197

2197-
return account, branch
2198+
return account, repo, branch
21982199

21992200

22002201
def det_pr_target_repo(paths):
@@ -2291,7 +2292,7 @@ def update_pr(pr_id, paths, ecs, commit_msg=None):
22912292
exit_code=EasyBuildExit.OPTION_ERROR
22922293
)
22932294

2294-
github_account, branch_name = det_account_branch_for_pr(pr_id, pr_target_repo=pr_target_repo)
2295+
github_account, _, branch_name = det_account_branch_for_pr(pr_id, pr_target_repo=pr_target_repo)
22952296

22962297
update_branch(branch_name, paths, ecs, github_account=github_account, commit_msg=commit_msg)
22972298

@@ -2883,18 +2884,18 @@ def sync_pr_with_develop(pr_id):
28832884
target_account = build_option('pr_target_account')
28842885
target_repo = build_option('pr_target_repo') or GITHUB_EASYCONFIGS_REPO
28852886

2886-
pr_account, pr_branch = det_account_branch_for_pr(pr_id)
2887+
pr_account, pr_repo, pr_branch = det_account_branch_for_pr(pr_id)
28872888

28882889
# initialize repository
28892890
git_working_dir = tempfile.mkdtemp(prefix='git-working-dir')
28902891
git_repo = init_repo(git_working_dir, target_repo)
28912892

2892-
setup_repo(git_repo, pr_account, target_repo, pr_branch)
2893+
setup_repo(git_repo, pr_account, pr_repo, pr_branch)
28932894

28942895
sync_with_develop(git_repo, pr_branch, target_account, target_repo)
28952896

28962897
# push updated branch back to GitHub (unless we're doing a dry run)
2897-
return push_branch_to_github(git_repo, pr_account, target_repo, pr_branch)
2898+
return push_branch_to_github(git_repo, pr_account, pr_repo, pr_branch)
28982899

28992900

29002901
def sync_branch_with_develop(branch_name):

test/framework/github.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,9 +1129,10 @@ def test_github_det_account_branch_for_pr(self):
11291129

11301130
# see https://github.com/easybuilders/easybuild-easyconfigs/pull/9149
11311131
self.mock_stdout(True)
1132-
account, branch = gh.det_account_branch_for_pr(9149, github_user=GITHUB_TEST_ACCOUNT)
1132+
account, repo, branch = gh.det_account_branch_for_pr(9149, github_user=GITHUB_TEST_ACCOUNT)
11331133
self.mock_stdout(False)
11341134
self.assertEqual(account, 'boegel')
1135+
self.assertEqual(repo, 'easybuild-easyconfigs')
11351136
self.assertEqual(branch, '20191017070734_new_pr_EasyBuild401')
11361137

11371138
init_config(build_options={

0 commit comments

Comments
 (0)