11
11
push :
12
12
branches :
13
13
- dev
14
+ workflow_dispatch : {}
14
15
15
16
jobs :
16
17
sync-branches :
@@ -22,36 +23,49 @@ jobs:
22
23
with :
23
24
app-id : ${{ secrets.OAI_SPEC_PUBLISHER_APPID }}
24
25
private-key : ${{ secrets.OAI_SPEC_PUBLISHER_PRIVATE_KEY }}
25
-
26
+
26
27
- name : Checkout repository
27
28
uses : actions/checkout@v5
28
29
with :
29
30
fetch-depth : 0
31
+ token : ${{ steps.generate-token.outputs.token }}
30
32
31
33
- name : Create pull requests
32
34
id : pull_requests
33
35
shell : bash
34
36
run : |
37
+ git config user.name "github-actions[bot]"
38
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
39
+
35
40
DEV_BRANCHES=$(git branch -r --list origin/v?.?-dev)
36
41
for DEV_BRANCH in $DEV_BRANCHES; do
37
42
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 \
39
53
--json number --jq '.[] | .number')
40
54
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"
42
56
continue
43
57
fi
44
58
45
- PR=$(gh pr create --base $BASE --head $HEAD \
59
+ PR=$(gh pr create --base $BASE --head $SYNC \
46
60
--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\`.")
49
63
echo ""
50
64
echo "PR to sync $DEV_BRANCH: $PR"
51
65
sleep 10 # allow status checks to be triggered
52
66
53
67
gh pr checks $PR --watch --required || continue
54
- gh pr merge $PR --merge --admin
68
+ # gh pr merge $PR --merge --admin
55
69
done
56
70
env :
57
71
GH_TOKEN : ${{ steps.generate-token.outputs.token }}
0 commit comments