-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.17 KB
/
prepare-release.yaml
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
name: Create PR from main to production
on:
push:
branches:
- main
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Fetch all branches
run: git fetch --all
- name: Check if there are changes between main and production
id: check_diff
run: |
git checkout main
git pull origin main
git checkout production
git pull origin production
DIFF=$(git diff main production)
if [ -z "$DIFF" ]; then
echo "No changes detected."
echo "::set-output name=changes::false"
else
echo "Changes detected."
echo "::set-output name=changes::true"
fi
- name: Create Pull Request
if: steps.check_diff.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: 'Update production branch'
body: 'This PR updates the production branch with changes from the main branch.'
draft: false
base: production
branch: main