vikenkd commited on
Commit
e26c60d
·
1 Parent(s): 22332be

[fix]: sync to hfspaces

Browse files
Files changed (1) hide show
  1. .github/workflows/sync_ahf.yaml +17 -7
.github/workflows/sync_ahf.yaml CHANGED
@@ -1,16 +1,15 @@
1
  name: Sync to Hugging Face hub
 
2
  on:
3
  push:
4
  branches: [main]
5
-
6
- # to run this workflow manually from the Actions tab
7
  workflow_dispatch:
8
- # Set up name HF_USERNAME and HF_TOKEN in the repository secrets
9
 
10
  env:
11
  HF_USERNAME: vikenkd
12
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
13
  SPACE_NAME: image_classification
 
14
 
15
  jobs:
16
  sync-to-hub:
@@ -20,7 +19,18 @@ jobs:
20
  with:
21
  fetch-depth: 0
22
  lfs: true
23
- - name: Push to hub
24
- env:
25
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
26
- run: git pull --allow-unrelated-histories && git push https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME main
 
 
 
 
 
 
 
 
 
 
 
 
1
  name: Sync to Hugging Face hub
2
+
3
  on:
4
  push:
5
  branches: [main]
 
 
6
  workflow_dispatch:
 
7
 
8
  env:
9
  HF_USERNAME: vikenkd
10
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
11
  SPACE_NAME: image_classification
12
+ EMAIL_USER: ${{ secrets.EMAIL_USER }}
13
 
14
  jobs:
15
  sync-to-hub:
 
19
  with:
20
  fetch-depth: 0
21
  lfs: true
22
+
23
+ - name: Configure Git
24
+ run: |
25
+ git config --global user.email "$EMAIL_USER"
26
+ git config --global user.name "tph-kds"
27
+
28
+ - name: Pull remote Hugging Face Space (merge if needed)
29
+ run: |
30
+ git remote add hf https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME || true
31
+ git fetch hf main || true
32
+ git pull hf main --allow-unrelated-histories --no-edit || true
33
+
34
+ - name: Push to Hugging Face Space
35
+ run: |
36
+ git push hf main