sync-fork #60
This file contains hidden or 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 | |
on: | |
repository_dispatch: | |
types: [sync-fork] | |
workflow_dispatch: | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Sync Fork (Excluding Workflows) | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email 'action@github.com' | |
# Setup sparse checkout | |
git remote add upstream https://github.com/iiits/alumni-portal.git | |
git sparse-checkout set --no-cone '/*' '!.github/workflows' | |
# Sync while preserving local workflows | |
git fetch upstream | |
git checkout main | |
git merge upstream/main --allow-unrelated-histories | |
git push origin main |