Spaces:
Sleeping
Sleeping
Update update_space_2.yaml
Browse files
.github/workflows/update_space_2.yaml
CHANGED
@@ -3,7 +3,7 @@ name: Update Space
|
|
3 |
on:
|
4 |
push:
|
5 |
branches:
|
6 |
-
main
|
7 |
|
8 |
jobs:
|
9 |
sync-to-hub:
|
@@ -11,6 +11,7 @@ jobs:
|
|
11 |
strategy:
|
12 |
matrix:
|
13 |
space_name: [company-pet-policy, about-mls, shakespeare] # List your Hugging Face space names here
|
|
|
14 |
steps:
|
15 |
- name: Checkout repository
|
16 |
uses: actions/checkout@v2
|
@@ -30,30 +31,21 @@ jobs:
|
|
30 |
env:
|
31 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
32 |
run: |
|
33 |
-
|
34 |
-
git config --global user.name "GitHub Actions"
|
35 |
-
huggingface-cli login --token ${{ secrets.HF_TOKEN }}
|
36 |
-
|
37 |
-
- name: Get Space Name
|
38 |
-
id: get_space_name
|
39 |
-
run: echo ${{ matrix.space_name }}
|
40 |
-
|
41 |
-
- name: Add Hugging Face Space as remote (loop through each space)
|
42 |
-
run: |
|
43 |
-
git remote add ${{ steps.get_space_name.outputs.value }} https://huggingface.co/spaces/david-oplatka/${{ steps.get_space_name.outputs.value }}.git
|
44 |
-
git config --add remote.${{ steps.get_space_name.outputs.value }}.oauth_token ${{ secrets.HF_TOKEN }}
|
45 |
-
|
46 |
|
47 |
- name: Get changed files
|
48 |
id: changed_files
|
49 |
run: |
|
|
|
50 |
git diff --name-only origin/main HEAD
|
51 |
-
|
52 |
- name: Push only changed files (loop through each space)
|
53 |
run: |
|
54 |
changed_files=$(echo "${{ steps.changed_files.outputs.value }}")
|
55 |
for file in $changed_files; do
|
56 |
git add $file
|
57 |
git commit -m "Updating $file"
|
58 |
-
git
|
|
|
|
|
59 |
done
|
|
|
3 |
on:
|
4 |
push:
|
5 |
branches:
|
6 |
+
- main
|
7 |
|
8 |
jobs:
|
9 |
sync-to-hub:
|
|
|
11 |
strategy:
|
12 |
matrix:
|
13 |
space_name: [company-pet-policy, about-mls, shakespeare] # List your Hugging Face space names here
|
14 |
+
|
15 |
steps:
|
16 |
- name: Checkout repository
|
17 |
uses: actions/checkout@v2
|
|
|
31 |
env:
|
32 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
33 |
run: |
|
34 |
+
huggingface-cli login --token $HF_TOKEN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
- name: Get changed files
|
37 |
id: changed_files
|
38 |
run: |
|
39 |
+
git fetch origin
|
40 |
git diff --name-only origin/main HEAD
|
41 |
+
|
42 |
- name: Push only changed files (loop through each space)
|
43 |
run: |
|
44 |
changed_files=$(echo "${{ steps.changed_files.outputs.value }}")
|
45 |
for file in $changed_files; do
|
46 |
git add $file
|
47 |
git commit -m "Updating $file"
|
48 |
+
git remote add ${{ matrix.space_name }} https://huggingface.co/spaces/david-oplatka/${{ matrix.space_name }}.git
|
49 |
+
git config --add remote.${{ matrix.space_name }}.oauth_token ${{ secrets.HF_TOKEN }}
|
50 |
+
git push ${{ matrix.space_name }} main
|
51 |
done
|