Update main.yml
Browse files- .github/workflows/main.yml +22 -13
.github/workflows/main.yml
CHANGED
@@ -19,24 +19,33 @@ jobs:
|
|
19 |
git config user.email [email protected]
|
20 |
git config pull.rebase false
|
21 |
|
22 |
-
- name:
|
23 |
env:
|
24 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
25 |
-
run: git fetch https://reichaves:[email protected]/spaces/reichaves/Chatbot-with-MaritacaAI-for-PDFs main
|
26 |
-
|
27 |
-
- name: Merge changes
|
28 |
run: |
|
29 |
-
git
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
run: |
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
fi
|
38 |
|
39 |
-
- name: Push to
|
40 |
env:
|
41 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
42 |
-
run:
|
|
|
|
19 |
git config user.email [email protected]
|
20 |
git config pull.rebase false
|
21 |
|
22 |
+
- name: Initialize if needed
|
23 |
env:
|
24 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
|
|
|
|
|
25 |
run: |
|
26 |
+
if ! git remote | grep -q "hf"; then
|
27 |
+
git remote add hf https://reichaves:[email protected]/spaces/reichaves/Chatbot-with-MaritacaAI-for-PDFs
|
28 |
+
fi
|
29 |
+
|
30 |
+
- name: Attempt sync
|
31 |
+
env:
|
32 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
33 |
run: |
|
34 |
+
# Fetch from Hugging Face
|
35 |
+
git fetch hf main || true
|
36 |
+
|
37 |
+
# Try to merge
|
38 |
+
if git merge hf/main --allow-unrelated-histories -m "Merge Hugging Face changes" ; then
|
39 |
+
echo "Merge successful"
|
40 |
+
else
|
41 |
+
echo "Merge failed, using local version"
|
42 |
+
git merge --abort
|
43 |
+
# Force push local version
|
44 |
+
git push -f hf main
|
45 |
fi
|
46 |
|
47 |
+
- name: Push to Hugging Face
|
48 |
env:
|
49 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
50 |
+
run: |
|
51 |
+
git push hf main || git push -f hf main
|