Skip to content

Update update_space_2.yaml #92

Update update_space_2.yaml

Update update_space_2.yaml #92

name: Sync and Push to Hugging Face
on:
push:
branches:
- main # Trigger the workflow on push to the main branch
jobs:
sync-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
space_name: [company-pet-policy, about-mls, shakespeare] # List your Hugging Face space names here
steps:
- name: Checkout Source Repository
uses: actions/checkout@v3
- name: Set up SSH for Hugging Face
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Configure SSH known hosts for Hugging Face
run: |
mkdir -p ~/.ssh
ssh-keyscan hf.co >> ~/.ssh/known_hosts
- name: Clone and Pull Target Hugging Face Repository
run: |
git clone [email protected]:spaces/david-oplatka/${{ matrix.space_name }}.git $RUNNER_TEMP/spaces/
- name: Check Working directories
run: |
ls -lR /home/runner/work
- name: Sync Source Repository with Temporary Folder
run: |
pwd
ls -lR $GITHUB_WORKSPACE
rsync -av --exclude '.*' $GITHUB_WORKSPACE/* $RUNNER_TEMP/spaces/folder-${{ matrix.space_name }}
cd $RUNNER_TEMP/spaces/folder-${{ matrix.space_name }}
pwd
git status
git add -A .
git commit -m "Sync updates from source repository" || echo "No changes to commit"
- name: Print Cloned Directory Contents After Sync
run: |
pwd
ls -lR $RUNNER_TEMP/spaces
- name: Push changes to Hugging Face Space
env:
HF_ACCESS_TOKEN: ${{ secrets.HF_TOKEN }} # Replace with your actual secret name
run: |
git push [email protected]:spaces/david-oplatka/${{ matrix.space_name }}.git