Sync Fork with Upstream #265
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 Fork with Upstream | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Schedule the workflow to run daily, you can customize the schedule | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Configure upstream remote | |
run: | | |
git remote add upstream https://github.com/nhost/nhost.git | |
git fetch upstream | |
- name: Merge upstream changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Sync Fork" | |
git checkout main | |
commit_hash=$(git rev-parse HEAD) | |
git merge --allow-unrelated-histories -X theirs upstream/main -m "Merge upstream changes" | |
git reset --soft $commit_hash | |
git restore --staged .github | |
git commit -m "Merge upstream changes" | |
git push origin main |