Skip to content

Commit 8154292

Browse files
committed
Create sync-dev-to-vX.Y-dev.yaml
1 parent b5ab378 commit 8154292

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: sync-dev-to-vX.Y-dev
2+
3+
# author: @ralfhandl
4+
5+
#
6+
# This workflow creates PRs to update the vX.Y-dev branch with the latest changes from dev
7+
#
8+
9+
# run this on push to dev
10+
on:
11+
push:
12+
branches:
13+
- dev
14+
- main-workflow-sync-dev-to-vX.Y-dev #TODO: remove after testing
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 requests
24+
id: pull_requests
25+
shell: bash
26+
run: |
27+
DEV_BRANCHES=$(git branch -r --list origin/v?.?-dev)
28+
for DEV_BRANCH in $DEV_BRANCHES; do
29+
BASE=${DEV_BRANCH:7}
30+
EXISTS=$(gh pr list --base $BASE --head $HEAD \
31+
--json number --jq '.[] | .number')
32+
if [ ! -z "$EXISTS" ]; then
33+
echo "PR #$EXISTS already wants to merge $HEAD into $BASE"
34+
exit 0
35+
fi
36+
37+
gh pr create --base $BASE --head $HEAD \
38+
--label "Housekeeping" \
39+
--title "$BASE: update from $HEAD" \
40+
--body "Merge \`$HEAD\` into \`$BASE\`."
41+
done
42+
env:
43+
GH_TOKEN: ${{ github.token }}
44+
HEAD: dev

0 commit comments

Comments
 (0)