name: Deploy to Hugging Face Space on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout GitHub repo uses: actions/checkout@v4 with: fetch-depth: 0 - name: Configure Git run: | git config --global user.email "actions@github.com" git config --global user.name "GitHub Actions" - name: Add Hugging Face remote run: | git remote add hf https://user:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/mazen248/telecom-rag-fastapi # Pull ONLY README.md from HF Space - name: Preserve Hugging Face README run: | git fetch hf git checkout hf/main -- README.md || true - name: Commit restored README if changed run: | git add README.md git diff --cached --quiet || git commit -m "Preserve HF README" - name: Push to Hugging Face run: | git push hf main --force