From c145823103aa6a03930ab8cff12c92d2fd151a13 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 19 Aug 2022 18:19:55 +0100 Subject: [PATCH] Make "Update release branch" workflow fail if `npm version` fails --- .github/update-release-branch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/update-release-branch.py b/.github/update-release-branch.py index c5f5c1dbbb..27d0fa08b2 100644 --- a/.github/update-release-branch.py +++ b/.github/update-release-branch.py @@ -88,6 +88,7 @@ def open_pr( body.append('') body.append('Please review the following:') if len(conflicted_files) > 0: + body.append('- The package.json file contains the correct version.') body.append(' - [ ] You have added commits to this branch that resolve the merge conflicts ' + 'in the following files:') body.extend([f' - [ ] `{file}`' for file in conflicted_files]) @@ -296,15 +297,15 @@ def main(): # 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, '--no-git-tag-version']) + subprocess.check_output(['npm', 'version', version, '--no-git-tag-version']) 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']) + subprocess.check_output(['sed', '-i', 's/^## 2\./## 1./g', 'CHANGELOG.md']) # Remove changelog notes from v2 that don't apply to v1 - subprocess.run(['sed', '-i', '/^- \[v2+ only\]/d', 'CHANGELOG.md']) + subprocess.check_output(['sed', '-i', '/^- \[v2+ only\]/d', 'CHANGELOG.md']) # Amend the commit generated by `npm version` to update the CHANGELOG run_git('add', 'CHANGELOG.md')