Skip to content

Commit 59fcfc8

Browse files
committed
Add dry-run input to prepare-mergeback-branch
1 parent 004251c commit 59fcfc8

File tree

1 file changed

+23
-10
lines changed
  • .github/actions/prepare-mergeback-branch

1 file changed

+23
-10
lines changed

.github/actions/prepare-mergeback-branch/action.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,33 @@ inputs:
1616
token:
1717
description: "The token to use"
1818
required: true
19+
dry-run:
20+
description: "Set to true to skip creating the PR. The branch will still be pushed."
21+
default: "false"
1922
runs:
2023
using: composite
2124
steps:
2225
- name: Create mergeback branch
26+
shell: bash
27+
env:
28+
VERSION: "${{ inputs.version }}"
29+
NEW_BRANCH: "${{ inputs.branch }}"
30+
run: |
31+
set -exu
32+
33+
# Update the version number ready for the next release
34+
npm version patch --no-git-tag-version
35+
36+
# Update the changelog, adding a new version heading directly above the most recent existing one
37+
awk '!f && /##/{print "'"## [UNRELEASED]\n\nNo user facing changes.\n"'"; f=1}1' CHANGELOG.md > temp && mv temp CHANGELOG.md
38+
git add .
39+
git commit -m "Update changelog and version after ${VERSION}"
40+
41+
git push origin "${NEW_BRANCH}"
42+
43+
- name: Create PR
44+
shell: bash
45+
if: inputs.dry-run != 'false'
2346
env:
2447
VERSION: "${{ inputs.version }}"
2548
BASE_BRANCH: "${{ inputs.base }}"
@@ -42,16 +65,6 @@ runs:
4265
EOF
4366
)
4467
45-
# Update the version number ready for the next release
46-
npm version patch --no-git-tag-version
47-
48-
# Update the changelog, adding a new version heading directly above the most recent existing one
49-
awk '!f && /##/{print "'"## [UNRELEASED]\n\nNo user facing changes.\n"'"; f=1}1' CHANGELOG.md > temp && mv temp CHANGELOG.md
50-
git add .
51-
git commit -m "Update changelog and version after ${VERSION}"
52-
53-
git push origin "${NEW_BRANCH}"
54-
5568
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft
5669
# so that a maintainer can take the PR out of draft, thereby triggering the PR checks.
5770
gh pr create \

0 commit comments

Comments
 (0)