Skip to content

Commit

Permalink
Create sync-repo.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
devangpradhan authored Aug 20, 2024
1 parent 527a7f0 commit 52ad855
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/sync-repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Sync Repository

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

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for accurate merge

- name: Set up Git
run: |
git config user.name "devangprdhan"
git config user.email "[email protected]"
- name: Add upstream remote
run: |
git remote add upstream https://github.com/<original-owner>/<original-repo>.git
- name: Fetch upstream changes
run: |
git fetch upstream
- name: Merge upstream changes
run: |
git checkout main
git merge upstream/main
- name: Push changes to the repository
run: |
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 52ad855

Please sign in to comment.