GitHub Actions
Clean sync from GitHub - no large files in history
aca8ab4
name: Sync to Hugging Face Space
on:
push:
branches:
- main
workflow_dispatch:
jobs:
sync-to-space:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1 # Shallow clone to avoid large files in history
lfs: false # Don't fetch LFS files since we don't use them
- name: Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# Fail loudly and show each command
set -euxo pipefail
# Configure git
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git config --global credential.helper ""
export GIT_TERMINAL_PROMPT=0
echo "Current branch:"
git branch --show-current || true
echo "Git remotes:"
git remote -v
# Add/replace remote with token auth (note 'user' here)
git remote remove hf 2>/dev/null || true
git remote add hf "https://user:${HF_TOKEN}@huggingface.co/spaces/samir72/Multi-Agent-Research-Paper-Analysis-System"
echo "Testing authentication with git ls-remote..."
git ls-remote hf
echo "Creating fresh orphan branch without history..."
# Create a new branch with only current state (no history with large files)
git checkout --orphan temp-clean-branch
git add -A
git commit -m "Clean sync from GitHub - no large files in history"
echo "Force pushing clean branch to HF Space..."
git push --force hf temp-clean-branch:main