diff --git a/.github/workflows/PR-into-2022-2.yml b/.github/workflows/PR-into-2022-2.yml new file mode 100644 index 000000000..ebf3d89ee --- /dev/null +++ b/.github/workflows/PR-into-2022-2.yml @@ -0,0 +1,53 @@ +name: Merge and PR into 2022.2 + +run-name: Merge 2021.3 -> 2022.2 +on: + pull_request_target: + types: + - closed + branches: + - 'maintenance/mps20213' + +jobs: + merge-and-pr: + # only trigger if it was actually merged + if: github.event.pull_request.merged == true + + runs-on: ubuntu-latest + steps: + # checkout the target branch + - name: Checkout 2022.2 + uses: actions/checkout@v3 + with: + ref: 'maintenance/mps20222' + fetch-depth: 0 + + # actually merge from the previous branch + - name: Perform merge from 2021.3 to 2022.2 + run: | + # setup to allow to merge and commit + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + # actual merge operation + git merge --no-ff --message "Merge 2021.3 -> 2022.2" origin/maintenance/mps20213 -- || ( echo "Merge failed. Please merge manually!" ; exit 1 ) + + # actually merge from the previous branch + - name: Prepare environment variables for PR + run: | + NEW_TITLE='${{ github.event.pull_request.title }}' + NEW_TITLE="${NEW_TITLE% (2021.2 -> 2021.3)} (2021.3 -> 2022.2)" + + echo "NEW_TITLE=$NEW_TITLE" >> $GITHUB_ENV + + # create a PR based on the merge + - name: Create PR for MPS 2022.2 + uses: peter-evans/create-pull-request@v5 + with: + branch: 'merge/mps20222' + commit-message: Merge maintenance/mps20213 into maintenance/mps20222 + title: ${{ env.NEW_TITLE }} + body: | + This is an automatic PR which merges changes from `maintenance/mps20213` to `maintenance/mps20222` + + [Link to previous PR for `maintenance/mps20213`](${{ github.event.pull_request._links.html.href }})