Skip to content

Sync Notebooks Folder #25

Sync Notebooks Folder

Sync Notebooks Folder #25

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 "actions@github.com"
- 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