bipolar / .github /workflows /sync-to-hf.yml
zzejiao's picture
yash's hf bipolar demo code with github action set
3530638
name: Sync hf-bipolar to HF Space main
on:
push:
branches: [ demo_bipolar ]
workflow_dispatch: {}
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout demo_bipolar (with LFS)
uses: actions/checkout@v4
with:
ref: demo_bipolar
lfs: true
fetch-depth: 0
- name: Setup Git LFS
run: |
git lfs install
git lfs fetch --all
- name: Push hf-demo_bipolar to HF Space main
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
set -e
git config user.email "actions@github.com"
git config user.name "github-actions[bot]"
SPACE_ID="ymali/bipolar"
TARGET_BRANCH="main"
AUTHED_URL="https://user:${HF_TOKEN}@huggingface.co/spaces/${SPACE_ID}"
git remote add hf "$AUTHED_URL" || git remote set-url hf "$AUTHED_URL"
git lfs push hf --all
git push hf "HEAD:refs/heads/${TARGET_BRANCH}" --force