mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-utils.git
synced 2026-04-22 06:47:55 +00:00
41 lines
1.0 KiB
YAML
41 lines
1.0 KiB
YAML
name: Sync main and master branches
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Git
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- 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
|