Skip to content

Commit

Permalink
define backport commit message in constant
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfyson committed Dec 6, 2023
1 parent 3537bea commit a6ea3c5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"""

# NB: This exact commit message is used to find commits for reverting during backports.
# Changing it requires a transition period where both old and new versions are supported.
BACKPORT_COMMIT_MESSAGE = 'Update version and changelog for v'

# Name of the remote
ORIGIN = 'origin'
Expand Down Expand Up @@ -287,7 +290,7 @@ def main():
# This commit will not exist the first time we release the v{N-1} branch from the v{N} branch, so we
# use `git log --grep` to conditionally revert the commit.
print('Reverting the version number and changelog updates from the last release to avoid conflicts')
vOlder_update_commits = run_git('log', '--grep', '^Update version and changelog for v', '--format=%H').split()
vOlder_update_commits = run_git('log', '--grep', f'^{BACKPORT_COMMIT_MESSAGE}', '--format=%H').split()

if len(vOlder_update_commits) > 0:
print(f' Reverting {vOlder_update_commits[0]}')
Expand Down Expand Up @@ -329,7 +332,7 @@ def main():

# Amend the commit generated by `npm version` to update the CHANGELOG
run_git('add', 'CHANGELOG.md')
run_git('commit', '-m', f'Update version and changelog for v{version}')
run_git('commit', '-m', f'{BACKPORT_COMMIT_MESSAGE}{version}')
else:
# If we're performing a standard release, there won't be any new commits on the target branch,
# as these will have already been merged back into the source branch. Therefore we can just
Expand Down

0 comments on commit a6ea3c5

Please sign in to comment.