GitHub Actions commited on
Commit
2ab56c1
·
1 Parent(s): cf33fa1

Update .github/workflows/update_space_2.yaml in about-mls

Browse files
Files changed (1) hide show
  1. .github/workflows/update_space_2.yaml +16 -42
.github/workflows/update_space_2.yaml CHANGED
@@ -1,4 +1,4 @@
1
- name: Update Hugging Face Space
2
 
3
  on:
4
  push:
@@ -19,52 +19,26 @@ jobs:
19
  fetch-depth: 0
20
  lfs: true
21
 
22
- - name: Set up SSH
23
- uses: webfactory/[email protected]
24
- with:
25
- ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
26
-
27
- - name: Configure SSH known hosts
28
- run: |
29
- mkdir -p ~/.ssh
30
- ssh-keyscan hf.co >> ~/.ssh/known_hosts
31
-
32
  - name: Configure Git
33
  run: |
34
  git config --global user.email "[email protected]"
35
  git config --global user.name "GitHub Actions"
36
-
37
- - name: Install huggingface_hub
38
- run: pip install huggingface_hub
39
-
40
- - name: Login to Hugging Face (use secret token)
41
- env:
42
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
43
  run: |
44
- huggingface-cli login --token $HF_TOKEN
 
45
 
46
- - name: Set Hugging Face Space remote URL
47
  run: |
48
- REMOTE_NAME=space_${{ matrix.space_name }}
49
- [email protected]:spaces/david-oplatka/${{ matrix.space_name }}.git
50
- echo "Adding remote: $REMOTE_NAME with URL: $REMOTE_URL"
51
- if git remote | grep -q $REMOTE_NAME; then
52
- git remote set-url $REMOTE_NAME $REMOTE_URL
53
- else
54
- git remote add $REMOTE_NAME $REMOTE_URL
55
- fi
56
-
57
- - name: Show Remote connections
58
- run: git remote -v
59
-
60
- - name: Fetch changes from Hugging Face space
61
- run: git fetch space_${{ matrix.space_name }}
62
-
63
- - name: Push only changed files
64
  run: |
65
- for file in $(git diff --name-only HEAD~1 HEAD); do
66
- git checkout space_${{ matrix.space_name }}/main -- $file
67
- git add $file
68
- git commit -m "Update $file in ${{ matrix.space_name }}"
69
- git push [email protected]:spaces/david-oplatka/${{ matrix.space_name }}.git HEAD:main
70
- done
 
1
+ name: Update Space
2
 
3
  on:
4
  push:
 
19
  fetch-depth: 0
20
  lfs: true
21
 
 
 
 
 
 
 
 
 
 
 
22
  - name: Configure Git
23
  run: |
24
  git config --global user.email "[email protected]"
25
  git config --global user.name "GitHub Actions"
26
+
27
+ - name: Get changed files
28
+ id: changed_files
 
 
 
 
29
  run: |
30
+ git fetch origin
31
+ echo "::set-output name=value::$(git diff --name-only HEAD~1 HEAD || true)"
32
 
33
+ - name: Show changed files
34
  run: |
35
+ echo "Changed files:"
36
+ echo "${{ steps.changed_files.outputs.value }}"
37
+
38
+ - name: Push changed files to Hugging Face
39
+ env:
40
+ HF_TOKEN: ${{ secrets.HF_TOKEN }} # Your Hugging Face token secret
 
 
 
 
 
 
 
 
 
 
41
  run: |
42
+ changed_files="${{ steps.changed_files.outputs.value }}"
43
+ echo "Files to push: $changed_files"
44
+ git push --force https://david-oplatka:[email protected]/spaces/david-oplatka/${{ matrix.space_name }}.git HEAD:main