Sync Notebooks Folder #6
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 Notebooks Folder | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # Runs at 00:00 every Sunday | |
workflow_dispatch: | |
jobs: | |
sync-notebooks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout destination repository | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
- name: Install rsync | |
run: sudo apt-get install rsync | |
- name: Rsync notebooks | |
run: | | |
git clone https://github.com/LorenFrankLab/spyglass.git tmp --depth=1 | |
rsync -av --exclude='.git/' tmp/notebooks/ ./notebooks/ | |
- name: Configure git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Commit changes | |
run: | | |
git add notebooks/ | |
git diff --staged --quiet || git commit -m "Sync notebooks" | |
- name: Pull with rebase | |
run: git pull --rebase | |
- name: Push changes | |
run: git push origin HEAD:main |