dani-ange commited on
Commit
c92d0af
·
unverified ·
1 Parent(s): 4bc2f82

Update train-deploy.yaml

Browse files
Files changed (1) hide show
  1. .github/workflows/train-deploy.yaml +17 -13
.github/workflows/train-deploy.yaml CHANGED
@@ -14,6 +14,8 @@ jobs:
14
  steps:
15
  - name: Checkout repository
16
  uses: actions/checkout@v3
 
 
17
 
18
  - name: Set up Python
19
  uses: actions/setup-python@v3
@@ -30,17 +32,19 @@ jobs:
30
  run: |
31
  huggingface-cli login --token "${{ secrets.HUGGINGFACE_API_TOKEN }}" --add-to-git-credential
32
 
33
- - name: Merge PR changes into main
34
  run: |
35
- git checkout "master" # Switch to main branch
 
 
 
36
  git pull origin master # Ensure latest changes
37
- git merge --no-ff origin/main -m "Merging PR changes from master"
38
- git push origin master # Push merged changes to main
39
 
40
- git checkout "master" # Switch to master branch
41
- git pull origin master # Ensure latest master
42
- git merge --no-ff origin/main -m "Merging latest changes from main"
43
- git push origin master # Push changes to master
 
44
  - name: Deploy to Hugging Face
45
  env:
46
  HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
@@ -49,10 +53,10 @@ jobs:
49
  git config --global user.email "[email protected]"
50
  git config --global user.name "dani-ange"
51
 
52
- git add .
53
- if ! git diff --cached --exit-code; then
54
- git commit -m "Updated model after merging PR"
55
- git push https://danielle2003:[email protected]/spaces/danielle2003/diabeties-ml main
56
- else
57
  echo "No changes to commit."
 
 
 
 
58
  fi
 
14
  steps:
15
  - name: Checkout repository
16
  uses: actions/checkout@v3
17
+ with:
18
+ fetch-depth: 0 # Ensures all branches are fetched
19
 
20
  - name: Set up Python
21
  uses: actions/setup-python@v3
 
32
  run: |
33
  huggingface-cli login --token "${{ secrets.HUGGINGFACE_API_TOKEN }}" --add-to-git-credential
34
 
35
+ - name: Merge PR changes into master
36
  run: |
37
+ git config --global user.email "[email protected]"
38
+ git config --global user.name "dani-ange"
39
+
40
+ git checkout master # Switch to master branch
41
  git pull origin master # Ensure latest changes
 
 
42
 
43
+ # Merge PR changes from the pull request branch
44
+ git merge --no-ff ${{ github.head_ref }} -m "Merging PR changes from ${{ github.head_ref }}"
45
+
46
+ git push origin master # Push merged changes to master
47
+
48
  - name: Deploy to Hugging Face
49
  env:
50
  HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
 
53
  git config --global user.email "[email protected]"
54
  git config --global user.name "dani-ange"
55
 
56
+ if git diff --quiet; then
 
 
 
 
57
  echo "No changes to commit."
58
+ else
59
+ git add .
60
+ git commit -m "Updated model after merging PR"
61
+ git push https://danielle2003:[email protected]/spaces/danielle2003/diabeties-ml master
62
  fi