File size: 1,138 Bytes
aba0016
 
 
2fe6b48
 
aba0016
 
2fe6b48
aba0016
2fe6b48
 
 
aba0016
2fe6b48
cac385b
aba0016
2fe6b48
 
 
 
 
 
aba0016
 
 
2fe6b48
 
aba0016
2fe6b48
 
 
 
aba0016
 
2fe6b48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Update Spaces

on:
  push:
    branches: [ main ]  # Update this to your branch name if different

jobs:
  update-spaces:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        space_name: [company-pet-policy, about-mls, shakespeare]  # List your Hugging Face space names here
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Configure Git
        run: |
          git config --global user.email "[email protected]"
          git config --global user.name "GitHub Actions"

      - name: Update Space
        env:
          HF_TOKEN: ${{ secrets.HF_TOKEN }}
        run: |
          git remote set-url origin https://david-oplatka:[email protected]/spaces/david-oplatka/${{ matrix.space_name }}.git
          git pull --rebase origin main  # Pull with rebase to avoid merge conflicts

          # Check for any unstaged changes (potential conflicts)
          if [ $(git status --porcelain | grep '^##') ]; then
            echo "Error: Unstaged changes detected in Space. Resolve conflicts and try again."
            exit 1
          fi

          git push origin main