shakespeare / .github /workflows /update_spaces.yaml
david-oplatka's picture
Change checkout from v3 to v2
cac385b unverified
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 "actions@github.com"
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:$HF_TOKEN@huggingface.co/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