Create main.yml
Browse files- .github/workflows/main.yml +43 -0
.github/workflows/main.yml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches: [main]
|
6 |
+
workflow_dispatch:
|
7 |
+
|
8 |
+
jobs:
|
9 |
+
sync-to-hub:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
steps:
|
12 |
+
- uses: actions/checkout@v3
|
13 |
+
with:
|
14 |
+
fetch-depth: 0
|
15 |
+
lfs: true
|
16 |
+
|
17 |
+
- name: Configure Git
|
18 |
+
run: |
|
19 |
+
git config user.name github-actions
|
20 |
+
git config user.email [email protected]
|
21 |
+
git config pull.rebase false
|
22 |
+
|
23 |
+
- name: Fetch from hub
|
24 |
+
env:
|
25 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
26 |
+
run: git fetch https://reichaves:$HF_TOKEN@https://huggingface.co/spaces/reichaves/Chatbot-with-MaritacaAI-for-PDFs main
|
27 |
+
|
28 |
+
- name: Merge changes
|
29 |
+
run: |
|
30 |
+
git merge FETCH_HEAD --allow-unrelated-histories -m "Merge Hugging Face changes"
|
31 |
+
continue-on-error: true
|
32 |
+
|
33 |
+
- name: Check for merge conflicts
|
34 |
+
run: |
|
35 |
+
if git ls-files -u | grep -q '^'; then
|
36 |
+
echo "Merge conflicts detected. Please resolve them manually."
|
37 |
+
exit 1
|
38 |
+
fi
|
39 |
+
|
40 |
+
- name: Push to hub
|
41 |
+
env:
|
42 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
43 |
+
run: git push https://reichaves:$HF_TOKEN@https://huggingface.co/spaces/reichaves/Chatbot-with-MaritacaAI-for-PDFs main
|