From c9665e6850d561fbc01d2fec427a577a0a675082 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 15 Aug 2025 13:48:51 +0100 Subject: [PATCH] Add `dry-run` input to `prepare-mergeback-branch` --- .../prepare-mergeback-branch/action.yml | 33 +++++++++++++------ .github/workflows/rollback-release.yml | 1 + 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/actions/prepare-mergeback-branch/action.yml b/.github/actions/prepare-mergeback-branch/action.yml index b5fa178e6..eaeb653df 100644 --- a/.github/actions/prepare-mergeback-branch/action.yml +++ b/.github/actions/prepare-mergeback-branch/action.yml @@ -16,10 +16,33 @@ inputs: token: description: "The token to use" required: true + dry-run: + description: "Set to true to skip creating the PR. The branch will still be pushed." + default: "false" runs: using: composite steps: - name: Create mergeback branch + shell: bash + env: + VERSION: "${{ inputs.version }}" + NEW_BRANCH: "${{ inputs.branch }}" + run: | + set -exu + + # Update the version number ready for the next release + npm version patch --no-git-tag-version + + # Update the changelog, adding a new version heading directly above the most recent existing one + awk '!f && /##/{print "'"## [UNRELEASED]\n\nNo user facing changes.\n"'"; f=1}1' CHANGELOG.md > temp && mv temp CHANGELOG.md + git add . + git commit -m "Update changelog and version after ${VERSION}" + + git push origin "${NEW_BRANCH}" + + - name: Create PR + shell: bash + if: inputs.dry-run != 'true' env: VERSION: "${{ inputs.version }}" BASE_BRANCH: "${{ inputs.base }}" @@ -42,16 +65,6 @@ runs: EOF ) - # Update the version number ready for the next release - npm version patch --no-git-tag-version - - # Update the changelog, adding a new version heading directly above the most recent existing one - awk '!f && /##/{print "'"## [UNRELEASED]\n\nNo user facing changes.\n"'"; f=1}1' CHANGELOG.md > temp && mv temp CHANGELOG.md - git add . - git commit -m "Update changelog and version after ${VERSION}" - - git push origin "${NEW_BRANCH}" - # PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft # so that a maintainer can take the PR out of draft, thereby triggering the PR checks. gh pr create \ diff --git a/.github/workflows/rollback-release.yml b/.github/workflows/rollback-release.yml index 6efdbefa6..171611b6c 100644 --- a/.github/workflows/rollback-release.yml +++ b/.github/workflows/rollback-release.yml @@ -12,6 +12,7 @@ on: push: paths: - .github/workflows/rollback-release.yml + - .github/actions/prepare-mergeback-branch/** jobs: prepare: