daniel-was-taken's picture
Refactor Hugging Face sync workflow to remove LFS installation steps and clean up Git history
036f1e9
name: Sync to Hugging Face hub
on:
push:
branches: [main]
workflow_dispatch:
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to hub
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
# Remove data/ directory from entire Git history
git filter-branch --force --index-filter \
'git rm -r --cached --ignore-unmatch data/' \
--prune-empty --tag-name-filter cat -- --all
# Force garbage collection to clean up
git reflog expire --expire=now --all
git gc --prune=now --aggressive
# Add Hugging Face remote and force push clean history
git remote add hf https://daniel-was-taken:$HF_TOKEN@huggingface.co/spaces/daniel-was-taken/CompifAI
git push hf main --force