Skip to content

Commit

Permalink
added auto-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaranov34 committed Jul 10, 2024
1 parent 44824b2 commit ee1d6c0
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Sync Fork

on:
schedule:
- cron: '0 * * * *' # Runs every hour
workflow_dispatch:

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup Git
run: |
git config --global user.name 'dbaranovstonfi'
git config --global user.email '[email protected]'
- name: Fetch all branches
run: git fetch --all

- name: Add remote upstream
run: git remote add upstream https://github.com/broxus/ton-labs-block

- name: Fetch upstream branches
run: git fetch upstream

- name: Sync branches
run: |
for branch in $(git branch -r | grep upstream | grep -v '\->' | sed 's|upstream/||'); do
git checkout $branch 2>/dev/null || git checkout -b $branch upstream/$branch
git merge upstream/$branch --strategy-option theirs || git checkout --theirs .
done
- name: Push changes
env:
PAT: ${{ secrets.PAT }}
run: |
for branch in $(git branch -r | grep upstream | grep -v '\->' | sed 's|upstream/||'); do
git push https://dbaranovstonfi:${PAT}@github.com/ston-fi/ton-labs-block $branch
done

0 comments on commit ee1d6c0

Please sign in to comment.