UPDATING README.md #93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to HuggingFace Space | |
| on: | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| deploy: | |
| name: Sync to HuggingFace | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Check HF_TOKEN is set | |
| run: | | |
| if [ -z "${{ secrets.HF_TOKEN }}" ]; then | |
| echo "::warning::HF_TOKEN secret is not set – skipping HuggingFace deploy." | |
| echo "SKIP_DEPLOY=true" >> $GITHUB_ENV | |
| fi | |
| - name: Push to HuggingFace Space | |
| if: env.SKIP_DEPLOY != 'true' | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| git config --global user.email "ci@github.com" | |
| git config --global user.name "GitHub Actions" | |
| git remote add hf https://abhishek0164:${HF_TOKEN}@huggingface.co/spaces/abhishek0164/safetyguard-x 2>/dev/null || \ | |
| git remote set-url hf https://abhishek0164:${HF_TOKEN}@huggingface.co/spaces/abhishek0164/safetyguard-x | |
| git push hf main --force |