reichaves commited on
Commit
e6a166c
·
unverified ·
1 Parent(s): 592eff1

Update main.yml

Browse files
Files changed (1) hide show
  1. .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: Fetch from hub
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 merge FETCH_HEAD --allow-unrelated-histories -m "Merge Hugging Face changes"
30
- continue-on-error: true
31
-
32
- - name: Check for merge conflicts
 
 
 
33
  run: |
34
- if git ls-files -u | grep -q '^'; then
35
- echo "Merge conflicts detected. Please resolve them manually."
36
- exit 1
 
 
 
 
 
 
 
 
37
  fi
38
 
39
- - name: Push to hub
40
  env:
41
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
42
- run: git push https://reichaves:[email protected]/spaces/reichaves/Chatbot-with-MaritacaAI-for-PDFs main
 
 
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