Skip to content

Commit 179d4f1

Browse files
committed
Update sync-main-to-dev.yaml
1 parent eb0314e commit 179d4f1

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,28 @@ jobs:
3131
id: pull_request
3232
shell: bash
3333
run: |
34-
EXISTS=$(gh pr list --base $BASE --head $HEAD \
34+
git config user.name ${GITHUB_ACTOR}
35+
git config user.email "a@b.c"
36+
SYNC="$BASE-sync-with-$HEAD"
37+
git fetch origin $HEAD $BASE
38+
git checkout -b $SYNC origin/$SYNC || git checkout -b $SYNC origin/$BASE
39+
git merge origin/$HEAD
40+
git checkout origin/dev src/*
41+
git checkout origin/dev tests/*
42+
git commit -m "Restored src/* and tests/*"
43+
git push -u origin $SYNC
44+
45+
EXISTS=$(gh pr list --base $BASE --head $SYNC \
3546
--json number --jq '.[] | .number')
3647
if [ ! -z "$EXISTS" ]; then
37-
echo "PR #$EXISTS already wants to merge $HEAD into $BASE"
48+
echo "PR #$EXISTS already wants to merge $SYNC into $BASE"
3849
exit 0
3950
fi
4051
41-
gh pr create --base $BASE --head $HEAD \
52+
gh pr create --base $BASE --head $SYNC \
4253
--label "Housekeeping" \
43-
--title "$BASE: update from $HEAD" \
44-
--body "Merge \`$HEAD\` into \`$BASE\`."
54+
--title "$BASE: sync with $HEAD" \
55+
--body "Merge relevant changes from \`$HEAD\` into \`$BASE\`."
4556
env:
4657
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
4758
HEAD: main

0 commit comments

Comments
 (0)