1111 push :
1212 branches :
1313 - dev
14+ workflow_dispatch : {}
1415
1516jobs :
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-actions[bot]"
38+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
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 }}
0 commit comments