gavinzli commited on
Commit
d9bf0cf
·
1 Parent(s): da6fc10

Enhance GitHub Actions workflow; add rebase step before pushing to Hugging Face Hub

Browse files
Files changed (1) hide show
  1. .github/workflows/main.yml +2 -7
.github/workflows/main.yml CHANGED
@@ -9,26 +9,22 @@ jobs:
9
  sync-to-hub:
10
  runs-on: ubuntu-latest
11
  steps:
12
- # Checkout the repository with Git LFS support
13
  - uses: actions/checkout@v3
14
  with:
15
  fetch-depth: 0
16
- lfs: true # Enable Git LFS support
17
 
18
- # Install Git LFS
19
  - name: Install Git LFS
20
  run: |
21
  sudo apt-get update
22
  sudo apt-get install git-lfs -y
23
  git lfs install
24
 
25
- # Set Git user identity
26
  - name: Configure Git
27
  run: |
28
  git config --global user.email "[email protected]"
29
  git config --global user.name "GitHub Actions Bot"
30
 
31
- # Ensure large files are tracked (only if not already tracked)
32
  - name: Track large files with Git LFS
33
  run: |
34
  if ! grep -q "*.sqlite3" .gitattributes 2>/dev/null; then
@@ -37,16 +33,15 @@ jobs:
37
  git commit -m "Track *.sqlite3 files with Git LFS" || echo "No changes to commit"
38
  fi
39
 
40
- # Stage and commit any uncommitted large files
41
  - name: Commit large files
42
  run: |
43
  git add "*.sqlite3"
44
  git commit -m "Sync large files to Hugging Face" || echo "No changes to commit"
45
 
46
- # Push to Hugging Face Hub
47
  - name: Push to Hub
48
  env:
49
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
50
  run: |
51
  git remote set-url origin https://Oxbridge-Economics:[email protected]/spaces/Oxbridge-Economics/Mailbox
 
52
  git push origin main
 
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: Install Git LFS
18
  run: |
19
  sudo apt-get update
20
  sudo apt-get install git-lfs -y
21
  git lfs install
22
 
 
23
  - name: Configure Git
24
  run: |
25
  git config --global user.email "[email protected]"
26
  git config --global user.name "GitHub Actions Bot"
27
 
 
28
  - name: Track large files with Git LFS
29
  run: |
30
  if ! grep -q "*.sqlite3" .gitattributes 2>/dev/null; then
 
33
  git commit -m "Track *.sqlite3 files with Git LFS" || echo "No changes to commit"
34
  fi
35
 
 
36
  - name: Commit large files
37
  run: |
38
  git add "*.sqlite3"
39
  git commit -m "Sync large files to Hugging Face" || echo "No changes to commit"
40
 
 
41
  - name: Push to Hub
42
  env:
43
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
44
  run: |
45
  git remote set-url origin https://Oxbridge-Economics:[email protected]/spaces/Oxbridge-Economics/Mailbox
46
+ git pull origin main --rebase # Fetch and rebase remote changes
47
  git push origin main