Neural-Prophet-Predictor / .github /workflows /sync-to-hf-space.yml
Akshit Chaturvedi
updated script
f8d4216
# .github/workflows/sync-to-hf-space.yml
name: Sync to Hugging Face Space
on:
push:
branches:
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true # Enable LFS if you have large files
- name: Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USERNAME: GuitarGeorge
SPACE_ID: GuitarGeorge/Neural-Prophet-Predictor
run: |
echo "Attempting to push to Hugging Face Space: $SPACE_ID"
# Configure Git user
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
# Add Hugging Face as a remote using the actual username and token
# We use the format https://USERNAME:TOKEN@huggingface.co/spaces/SPACE_ID
git remote add hf_space "https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$SPACE_ID"
# clear any weird credential helpers
git config --global --unset credential.helper || true
# Force push to ensure the Space mirrors GitHub
# We redirect output to /dev/null to prevent the token from leaking in logs if git throws an error printing the URL
git push --force hf_space HEAD:refs/heads/main
echo "Push to Hugging Face Space completed."