Update All Branches #8
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: Update All Branches | |
on: | |
workflow_run: | |
workflows: ["Synchronize to main"] | |
types: | |
- completed | |
jobs: | |
update-branches: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up git | |
run: | | |
git config --global user.name 'Vustron' | |
git config --global user.email 'vustronvustronus@gmail.com' | |
- name: Fetch all branches | |
run: git fetch --all | |
- name: Update all branches | |
run: | | |
git branch -r | grep -v '\->' | while read remote; do | |
branch="${remote#origin/}" | |
if [ "$branch" != "main" ] && [ "$branch" != "HEAD" ]; then | |
git checkout "$branch" | |
git merge origin/main --no-edit || true | |
git push origin "$branch" | |
fi | |
done |