Skip to content

Commit 33b507f

Browse files
committed
Create sync-main-to-dev.yaml
1 parent b5ab378 commit 33b507f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
workflow_dispatch: {}
15+
16+
jobs:
17+
sync-branch:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Create pull request
24+
id: pull_request
25+
shell: bash
26+
run: |
27+
EXISTS=$(gh pr list --base $BASE --head $HEAD \
28+
--json number --jq '.[] | .number')
29+
if [ ! -z "$EXISTS" ]; then
30+
echo "PR #$EXISTS already wants to merge $HEAD into $BASE"
31+
exit 0
32+
fi
33+
34+
gh pr create --base $BASE --head $HEAD \
35+
--label "Housekeeping" \
36+
--reviewer "OAI/TSC" \
37+
--title "$BASE: update from $HEAD" \
38+
--body "Merge \`$HEAD\` into \`$BASE\`."
39+
env:
40+
GH_TOKEN: ${{ github.token }}
41+
HEAD: main
42+
BASE: dev

0 commit comments

Comments
 (0)