From 677c8fd84086d2922d2724bbb16b0a6f39d2abb0 Mon Sep 17 00:00:00 2001 From: Sai Varadula Date: Sat, 6 Jul 2024 04:40:20 +0530 Subject: [PATCH] git action to sync master to other branches --- .github/workflows/sync-branches.yml | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/sync-branches.yml diff --git a/.github/workflows/sync-branches.yml b/.github/workflows/sync-branches.yml new file mode 100644 index 000000000..8b095192c --- /dev/null +++ b/.github/workflows/sync-branches.yml @@ -0,0 +1,31 @@ +name: Sync Branches + +on: + push: + branches: + - master + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Git + run: | + git config --global user.name 'Your Name' + git config --global user.email 'your-email@example.com' + + - name: Sync branches + run: | + BRANCHES=("branch1" "branch2" "branch3" "branch4") + for BRANCH in "${BRANCHES[@]}" + do + git checkout $BRANCH + git merge master --no-edit + git push origin $BRANCH + done + env: + GITHUB_TOKEN: ${{ secrets.PAT }}