Nhật Minh commited on
Commit
cb37894
·
unverified ·
1 Parent(s): a6497da

Add GitHub Actions workflow to sync with Hugging Face

Browse files
Files changed (1) hide show
  1. .github/workflows/sync-to-hf.yml +27 -0
.github/workflows/sync-to-hf.yml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Sync to Hugging Face Space
2
+ on:
3
+ push:
4
+ branches: [ main ]
5
+ workflow_dispatch:
6
+
7
+ jobs:
8
+ sync-to-hub:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout repository
12
+ uses: actions/checkout@v3
13
+ with:
14
+ fetch-depth: 0
15
+ lfs: true
16
+
17
+ - name: Push to HF Space
18
+ env:
19
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
+ HF_USERNAME: "NghiaUS"
21
+ HF_SPACE_NAME: "vietfactcheck-demo"
22
+ run: |
23
+ git config --global user.email "action@github.com"
24
+ git config --global user.name "GitHub Action"
25
+ git remote add hf_space "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME}"
26
+ git pull hf_space main --allow-unrelated-histories -X ours || echo "Pull failed/No changes"
27
+ git push hf_space main --force