Skip to content

fix(ci): use oauth2 token format for HF Spaces git push #2

fix(ci): use oauth2 token format for HF Spaces git push

fix(ci): use oauth2 token format for HF Spaces git push #2

name: Deploy to Hugging Face Spaces
on:
push:
branches: [main]
paths-ignore:
- 'quarto/**'
- 'docs/**'
- 'tests/**'
- '*.md'
- '!hf-spaces/README.md'
workflow_dispatch:
concurrency:
group: hf-spaces-deploy
cancel-in-progress: true
permissions:
contents: read
jobs:
deploy-hf:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Prepare HF Spaces deployment
run: |
# Replace README with HF Spaces version (YAML frontmatter for Docker SDK)
cp hf-spaces/README.md README.md
- name: Push to Hugging Face Spaces
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add -A
git commit -m "Deploy to HF Spaces" --allow-empty
git remote add hf https://oauth2:${HF_TOKEN}@huggingface.co/spaces/pjt222/jigsawR
git push --force hf main