Skip to content

Commit ea8eb91

Browse files
committed
Update sync-dev-to-vX.Y-dev.yaml
Align with sync-main-to-dev.yaml
1 parent 21c1201 commit ea8eb91

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

.github/workflows/sync-dev-to-vX.Y-dev.yaml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
push:
1212
branches:
1313
- dev
14+
workflow_dispatch: {}
1415

1516
jobs:
1617
sync-branches:
@@ -22,36 +23,49 @@ jobs:
2223
with:
2324
app-id: ${{ secrets.OAI_SPEC_PUBLISHER_APPID }}
2425
private-key: ${{ secrets.OAI_SPEC_PUBLISHER_PRIVATE_KEY }}
25-
26+
2627
- name: Checkout repository
2728
uses: actions/checkout@v5
2829
with:
2930
fetch-depth: 0
31+
token: ${{ steps.generate-token.outputs.token }}
3032

3133
- name: Create pull requests
3234
id: pull_requests
3335
shell: bash
3436
run: |
37+
git config user.name ${GITHUB_ACTOR}
38+
git config user.email "[email protected]"
39+
3540
DEV_BRANCHES=$(git branch -r --list origin/v?.?-dev)
3641
for DEV_BRANCH in $DEV_BRANCHES; do
3742
BASE=${DEV_BRANCH:7}
38-
EXISTS=$(gh pr list --base $BASE --head $HEAD \
43+
SYNC="$BASE-sync-with-$HEAD"
44+
45+
git checkout -b $SYNC origin/$SYNC || git checkout -b $SYNC origin/$BASE
46+
git merge origin/$HEAD -m "Merge $HEAD into $SYNC"
47+
git checkout origin/$BASE src/*
48+
git checkout origin/$BASE tests/*
49+
git commit -m "Restored src/* and tests/*" || echo ""
50+
git push -u origin $SYNC
51+
52+
EXISTS=$(gh pr list --base $BASE --head $SYNC \
3953
--json number --jq '.[] | .number')
4054
if [ ! -z "$EXISTS" ]; then
41-
echo "PR #$EXISTS already wants to merge $HEAD into $BASE"
55+
echo "PR #$EXISTS already wants to merge $SYNC into $BASE"
4256
continue
4357
fi
4458
45-
PR=$(gh pr create --base $BASE --head $HEAD \
59+
PR=$(gh pr create --base $BASE --head $SYNC \
4660
--label "Housekeeping" \
47-
--title "$BASE: update from $HEAD" \
48-
--body "Merge \`$HEAD\` into \`$BASE\`.")
61+
--title "$BASE: sync with $HEAD" \
62+
--body "Merge relevant changes from \`$HEAD\` into \`$BASE\`.")
4963
echo ""
5064
echo "PR to sync $DEV_BRANCH: $PR"
5165
sleep 10 # allow status checks to be triggered
5266
5367
gh pr checks $PR --watch --required || continue
54-
gh pr merge $PR --merge --admin
68+
# gh pr merge $PR --merge --admin
5569
done
5670
env:
5771
GH_TOKEN: ${{ steps.generate-token.outputs.token }}

.github/workflows/sync-main-to-dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ jobs:
4040
4141
git checkout -b $SYNC origin/$SYNC || git checkout -b $SYNC origin/$BASE
4242
git merge origin/$HEAD -m "Merge $HEAD into $SYNC"
43-
git checkout origin/dev src/*
44-
git checkout origin/dev tests/*
43+
git checkout origin/$BASE src/*
44+
git checkout origin/$BASE tests/*
4545
git commit -m "Restored src/* and tests/*" || echo ""
4646
git push -u origin $SYNC
4747

0 commit comments

Comments
 (0)