Skip to content

Commit 56099fa

Browse files
authored
Include target branch in backport PR titles (#24868)
* Include target branch in backport PR title Backport PR titles now read `[Backport <branch>] <subject>` so the target release branch is visible in the PR list and notifications, not just in the base-ref column. * Add changelog entry for backport PR title change
1 parent dff8198 commit 56099fa

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

ddev/changelog.d/24868.added

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Include the target branch in backport PR titles (`[Backport <branch>] <subject>`).

ddev/src/ddev/cli/release/port_commit_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def build_port_plan(
740740
target_branch=target_branch,
741741
new_branch=new_branch,
742742
worktree_path=_worktree_path_for(app, new_branch),
743-
pr_title=f'[Backport] {clean_subject}',
743+
pr_title=f'[Backport {target_branch}] {clean_subject}',
744744
pr_body=build_pr_body(
745745
app,
746746
sha=full_sha,

ddev/tests/cli/release/test_port_commit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def test_command_happy_path(ddev: CliRunner, mocker: MockerFixture, fake_async_g
464464
pr_call = fake_async_github.last_call('create_pull_request')
465465
assert pr_call.kwargs['owner'] == 'DataDog'
466466
assert pr_call.kwargs['repo'] == 'integrations-core'
467-
assert pr_call.kwargs['title'] == '[Backport] Fix bug'
467+
assert pr_call.kwargs['title'] == '[Backport master] Fix bug'
468468
assert pr_call.kwargs['head'] == 'alice/port-1234567890-to-master'
469469
assert pr_call.kwargs['base'] == 'master'
470470
assert pr_call.kwargs['draft'] is False
@@ -792,7 +792,7 @@ def capture_side_effect(*args):
792792
'create_pull_request',
793793
owner='DataDog',
794794
repo='integrations-core',
795-
title='[Backport] Fix bug',
795+
title='[Backport master] Fix bug',
796796
head=f'alice/port-{commit_sha[:10]}-to-master',
797797
base='master',
798798
body=mocker.ANY,
@@ -1086,6 +1086,8 @@ def test_command_from_pr_ports_every_backport_label(
10861086
assert bases == ['7.62.x', '7.61.x']
10871087
heads = [c.kwargs['head'] for c in fake_async_github.calls_to('create_pull_request')]
10881088
assert heads == ['alice/port-1234567890-to-7.62.x', 'alice/port-1234567890-to-7.61.x']
1089+
titles = [c.kwargs['title'] for c in fake_async_github.calls_to('create_pull_request')]
1090+
assert titles == ['[Backport 7.62.x] Fix bug', '[Backport 7.61.x] Fix bug']
10891091

10901092

10911093
def test_command_from_pr_explicit_target_restricts_to_one_base(

0 commit comments

Comments
 (0)