From a6ea3c5a45b53ef29985956a67d19aa9db1fc2ef Mon Sep 17 00:00:00 2001 From: nickfyson Date: Wed, 6 Dec 2023 11:41:27 +0000 Subject: [PATCH] define backport commit message in constant --- .github/update-release-branch.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/update-release-branch.py b/.github/update-release-branch.py index d5ba6c925e..90d3c995b7 100644 --- a/.github/update-release-branch.py +++ b/.github/update-release-branch.py @@ -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' @@ -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]}') @@ -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