Skip to content

Commit 1dd2c02

Browse files
committed
Create sync-main-to-dev.yaml
New workflow to sync changes from main to dev via PRs
1 parent b5ab378 commit 1dd2c02

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: sync-main-to-dev
2+
3+
# author: @ralfhandl
4+
5+
#
6+
# This workflow creates PRs to update the dev branch with the latest changes from main
7+
#
8+
9+
# run this on push to main
10+
on:
11+
push:
12+
branches:
13+
- main
14+
15+
jobs:
16+
sync-branch:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Create pull request
23+
id: pull_request
24+
shell: bash
25+
run: |
26+
EXISTS=$(gh pr list --base $BASE --head $HEAD \
27+
--json number --jq '.[] | .number')
28+
if [ ! -z "$EXISTS" ]; then
29+
echo "PR #$EXISTS already wants to merge $HEAD into $BASE"
30+
exit 0
31+
fi
32+
33+
gh pr create --base $BASE --head $HEAD \
34+
--label "Housekeeping" \
35+
--title "$BASE: update from $HEAD" \
36+
--body "Merge \`$HEAD\` into \`$BASE\`."
37+
env:
38+
GH_TOKEN: ${{ github.token }}
39+
HEAD: main
40+
BASE: dev

0 commit comments

Comments
 (0)