Skip to content

Commit

Permalink
change version numbers inside processing function as well
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfyson committed Dec 15, 2023
1 parent 8e4a6c7 commit e0c2b0a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def get_today_string():
today = datetime.datetime.today()
return '{:%d %b %Y}'.format(today)

def process_changelog_for_backports(target_version):
def process_changelog_for_backports(source_branch_major_version, target_branch_major_version):

# changelog entries use a speficic format to indicate
# that they only apply to newer versions
Expand All @@ -191,6 +191,7 @@ def process_changelog_for_backports(target_version):

output += line + '\n'
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
break

Expand All @@ -206,10 +207,11 @@ def process_changelog_for_backports(target_version):
# filter out changenote entries that apply only to newer versions
match = regex.search(line)
if match:
if int(target_version) < int(match.group(1)):
if int(target_branch_major_version) < int(match.group(1)):
continue

if line.startswith('## '):
line = line.replace(f'## {source_branch_major_version}', f'## {target_branch_major_version}')
if found_content == False:
# we have found two headings in a row, so we need to add the placeholder message.
output += 'No user facing changes.\n'
Expand Down Expand Up @@ -375,10 +377,7 @@ def main():

# Migrate the changelog notes from vLatest version numbers to vOlder version numbers
print(f'Migrating changelog notes from v{source_branch_major_version} to v{target_branch_major_version}')
subprocess.check_output(['sed', '-i', f's/^## {source_branch_major_version}\./## {target_branch_major_version}./g', 'CHANGELOG.md'])

# process changelog for backport to target release branch
process_changelog_for_backports(target_branch_major_version)
process_changelog_for_backports(source_branch_major_version, target_branch_major_version)

# Amend the commit generated by `npm version` to update the CHANGELOG
run_git('add', 'CHANGELOG.md')
Expand Down

0 comments on commit e0c2b0a

Please sign in to comment.