Spaces:
Sleeping
Sleeping
File size: 1,818 Bytes
da095b2 a7b4bf6 975f1f1 da095b2 96a617e da095b2 96a617e da095b2 fe0c2fe 50f23f6 da095b2 b627a8f |
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
name: Restart Hugging Face Space
on:
workflow_dispatch:
inputs:
monitor_id:
description: 'input_monitor_id'
required: true
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
ref: main
- name: Set environment variables
run: |
if [ "${{ github.event.inputs.monitor_id }}" = "13" ]; then
export HF_TOKEN="${{ secrets.HF_1 }}"
export USERNAME="GordonChan365"
export SPACE="bot-example"
elif [ "${{ github.event.inputs.monitor_id }}" = "21" ]; then
export HF_TOKEN="${{ secrets.HF_1 }}"
export USERNAME="GordonChan365"
export SPACE="hf-llm-api"
elif [ "${{ github.event.inputs.monitor_id }}" = "2" ]; then
export HF_TOKEN="${{ secrets.HF_2 }}"
export USERNAME="gordonchan"
export SPACE="another-space"
else
echo "Invalid monitor_id"
exit 1
fi
rm -fr .githup
rm -f README.md
echo "
---
title: $SPACE
emoji: 🏢
colorFrom: yellow
colorTo: red
sdk: docker
app_port: 23333
pinned: false
---
">README.md
git add -A
git commit -m "update"
git push -f https://$USERNAME:$HF_TOKEN@huggingface.co/spaces/$USERNAME/$SPACE main:main
# - name: Update README title
# run: |
# sed -i "s/title: .*/title: $SPACE/" README.md
# - name: Restart Space
# run: |
# git push -f https://$USERNAME:$HF_TOKEN@huggingface.co/spaces/$USERNAME/$SPACE main:main
|