@@ -124,48 +124,15 @@ jobs:
124124 cat $PARTIAL_CHANGELOG
125125 echo "::endgroup::"
126126
127- - name : Create mergeback branch
127+ - name : Create mergeback branch and PR
128128 if : ${{ steps.check.outputs.exists != 'true' && endsWith(github.ref_name, steps.getVersion.outputs.latest_release_branch) }}
129- env :
130- VERSION : " ${{ steps.getVersion.outputs.version }}"
131- NEW_BRANCH : " ${{ steps.getVersion.outputs.newBranch }}"
132- GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
133- run : |
134- set -exu
135- pr_title="Mergeback ${VERSION} ${HEAD_BRANCH} into ${BASE_BRANCH}"
136- pr_body=$(cat << EOF
137- This PR bumps the version number and updates the changelog after the ${VERSION} release.
138-
139- Please do the following:
140-
141- - [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.
142- - [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.
143- - [ ] Mark the PR as ready for review to trigger the full set of PR checks.
144- - [ ] Approve and merge the PR. When merging the PR, make sure "Create a merge commit" is
145- selected rather than "Squash and merge" or "Rebase and merge".
146- EOF
147- )
148-
149- # Update the version number ready for the next release
150- npm version patch --no-git-tag-version
151-
152- # Update the changelog, adding a new version heading directly above the most recent existing one
153- awk '!f && /##/{print "'"## [UNRELEASED]\n\nNo user facing changes.\n"'"; f=1}1' CHANGELOG.md > temp && mv temp CHANGELOG.md
154- git add .
155- git commit -m "Update changelog and version after ${VERSION}"
156-
157- git push origin "${NEW_BRANCH}"
158-
159- # PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft
160- # so that a maintainer can take the PR out of draft, thereby triggering the PR checks.
161- gh pr create \
162- --head "${NEW_BRANCH}" \
163- --base "${BASE_BRANCH}" \
164- --title "${pr_title}" \
165- --label "Update dependencies" \
166- --body "${pr_body}" \
167- --assignee "${GITHUB_ACTOR}" \
168- --draft
129+ uses : ./.github/actions/prepare-mergeback-branch
130+ with :
131+ base : " ${{ env.BASE_BRANCH }}"
132+ head : " ${{ env.HEAD_BRANCH }}"
133+ branch : " ${{ steps.getVersion.outputs.newBranch }}"
134+ version : " ${{ steps.getVersion.outputs.version }}"
135+ token : " ${{ secrets.GITHUB_TOKEN }}"
169136
170137 - name : Generate token
171138
0 commit comments