Skip to content

Commit c0187c7

Browse files
authored
Merge pull request #3298 from migueldiascosta/fix_new_pr_from_branch_title
get pr_title and pr_descr built_options in new_pr_from_branch instead of new_pr (and commit_msg in both)
2 parents a594939 + ffa87c9 commit c0187c7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

easybuild/tools/github.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,11 +1333,18 @@ def new_branch_github(paths, ecs, commit_msg=None):
13331333

13341334

13351335
@only_if_module_is_available('git', pkgname='GitPython')
1336-
def new_pr_from_branch(branch_name, title=None, descr=None, pr_target_repo=None, pr_metadata=None):
1336+
def new_pr_from_branch(branch_name, title=None, descr=None, pr_target_repo=None, pr_metadata=None, commit_msg=None):
13371337
"""
13381338
Create new pull request from specified branch on GitHub.
13391339
"""
13401340

1341+
if descr is None:
1342+
descr = build_option('pr_descr')
1343+
if commit_msg is None:
1344+
commit_msg = build_option('pr_commit_msg')
1345+
if title is None:
1346+
title = build_option('pr_title') or commit_msg
1347+
13411348
pr_target_account = build_option('pr_target_account')
13421349
pr_target_branch = build_option('pr_target_branch')
13431350
if pr_target_repo is None:
@@ -1550,19 +1557,15 @@ def new_pr(paths, ecs, title=None, descr=None, commit_msg=None):
15501557
:param commit_msg: commit message to use
15511558
"""
15521559

1553-
if descr is None:
1554-
descr = build_option('pr_descr')
15551560
if commit_msg is None:
15561561
commit_msg = build_option('pr_commit_msg')
1557-
if title is None:
1558-
title = build_option('pr_title') or commit_msg
15591562

15601563
# create new branch in GitHub
15611564
res = new_branch_github(paths, ecs, commit_msg=commit_msg)
15621565
file_info, deleted_paths, _, branch_name, diff_stat, pr_target_repo = res
15631566

15641567
new_pr_from_branch(branch_name, title=title, descr=descr, pr_target_repo=pr_target_repo,
1565-
pr_metadata=(file_info, deleted_paths, diff_stat))
1568+
pr_metadata=(file_info, deleted_paths, diff_stat), commit_msg=commit_msg)
15661569

15671570

15681571
def det_account_branch_for_pr(pr_id, github_user=None, pr_target_repo=None):

test/framework/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,6 +3308,7 @@ def test_new_pr_from_branch(self):
33083308
'--new-pr-from-branch=%s' % test_branch,
33093309
'--github-user=%s' % GITHUB_TEST_ACCOUNT, # used to get GitHub token
33103310
'--github-org=boegel', # used to determine account to grab branch from
3311+
'--pr-descr="an easyconfig for toy"',
33113312
'-D',
33123313
]
33133314
txt, _ = self._run_mock_eb(args, do_build=True, raise_error=True, testing=False)
@@ -3326,6 +3327,7 @@ def test_new_pr_from_branch(self):
33263327
r"\* target: easybuilders/easybuild-easyconfigs:develop$",
33273328
r"^\* from: boegel/easybuild-easyconfigs:test_new_pr_from_branch_DO_NOT_REMOVE$",
33283329
r'^\* title: "\{tools\}\[system/system\] toy v0\.0"$',
3330+
r'^"an easyconfig for toy"$',
33293331
r"^ 1 file changed, 32 insertions\(\+\)$",
33303332
r"^\* overview of changes:\n easybuild/easyconfigs/t/toy/toy-0\.0\.eb | 32",
33313333
]

0 commit comments

Comments
 (0)