-
Notifications
You must be signed in to change notification settings - Fork 51
53 lines (44 loc) · 1.8 KB
/
PR-into-2022-2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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 }})