File size: 1,296 Bytes
e296fb4
db40fc9
a938ee3
a48496c
 
e7be8a5
a938ee3
 
 
 
 
 
3a88bbb
e7be8a5
a938ee3
 
 
 
 
 
9b72910
a938ee3
 
 
 
e296fb4
 
 
3a88bbb
e296fb4
 
3cf1e97
e296fb4
3ccd604
e296fb4
 
 
 
 
 
3a88bbb
e296fb4
 
 
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
37
38
39
40
41
42
43
44
45
name: Update Space

on:
  push:
    branches:
      - main

jobs:
  sync-to-hub:
    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
        with:
          fetch-depth: 0
          lfs: true

      - name: Configure Git
        run: |
          git config --global user.email "[email protected]"
          git config --global user.name "GitHub Actions"
          
      - name: Get changed files
        id: changed_files
        run: |
          git fetch origin
          echo "::set-output name=value::$(git diff --name-only HEAD~1 HEAD || true)"

      - name: Show changed files
        run: |
          echo "Changed files:"
          echo "${{ steps.changed_files.outputs.value }}"
          
      - name: Push changed files to Hugging Face
        env:
          HF_TOKEN: ${{ secrets.HF_TOKEN }}  # Your Hugging Face token secret
        run: |
          changed_files="${{ steps.changed_files.outputs.value }}"
          echo "Files to push: $changed_files"
          git push --force https://david-oplatka:[email protected]/spaces/david-oplatka/${{ matrix.space_name }}.git HEAD:main