-
Notifications
You must be signed in to change notification settings - Fork 9.2k
40 lines (34 loc) · 959 Bytes
/
sync-main-to-dev.yaml
File metadata and controls
40 lines (34 loc) · 959 Bytes
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
name: sync-main-to-dev
# author: @ralfhandl
#
# This workflow creates PRs to update the dev branch with the latest changes from main
#
# run this on push to main
on:
push:
branches:
- main
jobs:
sync-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create pull request
id: pull_request
shell: bash
run: |
EXISTS=$(gh pr list --base $BASE --head $HEAD \
--json number --jq '.[] | .number')
if [ ! -z "$EXISTS" ]; then
echo "PR #$EXISTS already wants to merge $HEAD into $BASE"
exit 0
fi
gh pr create --base $BASE --head $HEAD \
--label "Housekeeping" \
--title "$BASE: update from $HEAD" \
--body "Merge \`$HEAD\` into \`$BASE\`."
env:
GH_TOKEN: ${{ github.token }}
HEAD: main
BASE: dev