From f2c09fb28a72ad25e3fee95f3710860dbf771574 Mon Sep 17 00:00:00 2001 From: Nick Fyson Date: Mon, 15 Apr 2024 15:54:09 +0100 Subject: [PATCH 1/2] fix handling of backport changelog --- .github/update-release-branch.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/update-release-branch.py b/.github/update-release-branch.py index c68ca149e3..c078d738a6 100644 --- a/.github/update-release-branch.py +++ b/.github/update-release-branch.py @@ -187,14 +187,18 @@ def process_changelog_for_backports(source_branch_major_version, target_branch_m # until we find the first section, just duplicate all lines while True: + found_first_section = False line = f.readline() if not line: raise Exception('Could not find any change sections in CHANGELOG.md') # EOF - output += line if line.startswith('## '): line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}') - # we have found the first section, so now handle things differently + found_first_section = True + + output += line + if found_first_section: + # we now handle things differently break # found_content tracks whether we hit two headings in a row From c7a8056fc3032a82712cbf41bda3d5731e1a11df Mon Sep 17 00:00:00 2001 From: Nick Fyson Date: Tue, 16 Apr 2024 15:05:09 +0100 Subject: [PATCH 2/2] simplify while loop --- .github/update-release-branch.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/update-release-branch.py b/.github/update-release-branch.py index c078d738a6..0787d7dddc 100644 --- a/.github/update-release-branch.py +++ b/.github/update-release-branch.py @@ -186,8 +186,8 @@ def process_changelog_for_backports(source_branch_major_version, target_branch_m with open('CHANGELOG.md', 'r') as f: # until we find the first section, just duplicate all lines - while True: - found_first_section = False + found_first_section = False + while not found_first_section: line = f.readline() if not line: raise Exception('Could not find any change sections in CHANGELOG.md') # EOF @@ -197,9 +197,6 @@ def process_changelog_for_backports(source_branch_major_version, target_branch_m found_first_section = True output += line - if found_first_section: - # we now handle things differently - break # found_content tracks whether we hit two headings in a row found_content = False