mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-utils.git
synced 2026-04-22 02:07:56 +00:00
fix: bidirectional sync between main and master branches
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
name: Sync master to main
|
||||
name: Sync main and master branches
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
@@ -13,11 +14,27 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Sync master to main
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git checkout main
|
||||
git merge master --no-edit
|
||||
git push origin main
|
||||
|
||||
- name: Sync branches
|
||||
run: |
|
||||
# Get the branch that was pushed to
|
||||
PUSHED_BRANCH="${GITHUB_REF#refs/heads/}"
|
||||
|
||||
if [ "$PUSHED_BRANCH" = "main" ]; then
|
||||
TARGET_BRANCH="master"
|
||||
else
|
||||
TARGET_BRANCH="main"
|
||||
fi
|
||||
|
||||
echo "Syncing $PUSHED_BRANCH → $TARGET_BRANCH"
|
||||
|
||||
git fetch origin $TARGET_BRANCH || git checkout -b $TARGET_BRANCH
|
||||
git checkout $TARGET_BRANCH
|
||||
git merge origin/$PUSHED_BRANCH --no-edit -m "Sync from $PUSHED_BRANCH"
|
||||
git push origin $TARGET_BRANCH
|
||||
|
||||
Reference in New Issue
Block a user