-
Notifications
You must be signed in to change notification settings - Fork 54
48 lines (47 loc) · 1.99 KB
/
merge-release-changes-to-main.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
on:
push:
branches:
- 'workflows/gh-action-merge-release-changes-into-main'
env:
starting_branch: ${{ github.ref }}
working_branch: workflows/merge-release-changes-to-main
base_branch: main
permissions:
contents: write
issues: write
pull-requests: write
jobs:
check_out:
runs-on: ubuntu-latest
if: ${{ github.repository }} == 'hemlholtz-analytics/heat'
steps:
# make sure that new branch is created from starting_branch
- name: Delete working branch if it already exists
run: git push --delete origin ${{ env.working_branch }} || true
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: '${{ env.starting_branch }}'
- name: Create working branch
run: |
git checkout -b ${{ env.working_branch }} ${{ env.starting_branch }}
git pull ${{ env.working_branch }}
git push --set-upstream origin ${{ env.working_branch }}
# - name: Check for differences between release and main
# run: |
# git fetch origin ${{ env.base_branch }}
# DIFF=$(git log origin/${{ env.base_branch }}..${{ env.working_branch }})
# if [ -z "$DIFF" ]; then
# echo "No differences found. Exiting without creating a pull request."
# exit 0
# fi
- name: Create a pull request
uses: peter-evans/create-pull-request@v4
with:
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Merge release changes to main'
title: 'Merge ${{ env.starting_branch }} changes to ${{ env.base_branch }}'
body: 'This PR merges changes from release branch to main branch'
branch: '${{ env.working_branch }}'
base: '${{ env.base_branch }}'