diff --git a/.github/workflows/sync-to-latest.yml b/.github/workflows/sync-to-latest.yml new file mode 100644 index 0000000..ce8131e --- /dev/null +++ b/.github/workflows/sync-to-latest.yml @@ -0,0 +1,46 @@ +name: Sync with Upstream + +on: + push: + branches: + - main + schedule: + - cron: '0 * * * *' # Runs every hour to check for updates, adjust the cron as needed + workflow_dispatch: + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout the forked repo + uses: actions/checkout@v3 + with: + repository: abdbbdii/go-whatsapp-web-multidevice-abd + ref: main + + - name: Add Upstream Repository + run: git remote add upstream https://github.com/aldinokemal/go-whatsapp-web-multidevice + + - name: Fetch Upstream Changes + run: git fetch upstream + + - name: Merge Upstream Changes + run: | + git checkout -b update-upstream + git merge upstream/main --no-commit --no-ff + git checkout --ours src/cmd/root.go # Keep your version of root.go + git add src/cmd/root.go + git commit -m "Merge upstream changes" + git checkout main + git merge update-upstream + git branch -d update-upstream + + - name: Install Go Dependencies + run: go get github.com/joho/godotenv + + - name: Push Changes to Forked Repo + run: | + git config user.name "GitHub Action" + git config user.email "action@github.com" + git push origin main