message: Avoid commits with duplicate names during v2 to v1 backport
diff: @@ -239,12 +239,19 @@ def main():
  run_git('checkout', '-b', new_branch_name, ORIGIN + '/' + args.source_branch)
  if args.perform_v2_to_v1_backport:
  + # Migrate the package version number from a v2 version number to a v1 version number
  print(f'Setting version number to {version}')
  - subprocess.run(['npm', 'version', version])
  - run_git('add', 'package.json', 'package-lock.json', 'runner/package.json', 'runner/package-lock.json')
  + subprocess.run(['npm', 'version', version, '--no-git-tag-version'])
  + run_git('reset', 'HEAD~1')
  + run_git('add', 'package.json', 'package-lock.json')
  + # Migrate the changelog notes from v2 version numbers to v1 version numbers
  print('Migrating changelog notes from v2 to v1')
  subprocess.run(['sed', '-i', 's/## 2./## 1./g', 'CHANGELOG.md'])
  +
  + # Amend the commit generated by `npm version` to update the CHANGELOG
  + run_git('add', 'CHANGELOG.md')
  + run_git('commit', '--amend', '-m', f'Update version and changelog for v{version}')
  else:
  # We don't need to do this for a v1 release, since the changelog has already been updated in the v2 branch.
  print('Updating changelog')
  @@ -252,7 +259,7 @@ def main():
  # Create a commit that updates the CHANGELOG
  run_git('add', 'CHANGELOG.md')
  - run_git('commit', '-m', version)
  + run_git('commit', '-m', f'Update changelog for v{version}')
  run_git('push', ORIGIN, new_branch_name)
  