Merge branch 'main' of github.com:myeolinmalchi/PNUME-chat #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync main to feature branches | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
branch-sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up git | |
run: | | |
git config --global user.name 'myeolinmalchi' | |
git config --global user.email '[email protected]' | |
- name: Get all feature branches | |
id: get-branches | |
run: | | |
git fetch --all | |
git branch -r | grep 'origin/feature/' | sed 's/origin\///' > feature_branches.txt | |
echo "::set-output name=branches::$(cat feature_branches.txt | tr '\n' ' ')" | |
- name: Push changes to all feature branches | |
run: | | |
for branch in ${{ steps.get-branches.outputs.branches }}; do | |
git checkout $branch | |
git merge main -X theirs || git merge --abort | |
git push origin $branch | |
done |