Spaces:
Sleeping
Sleeping
| 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 | |
| sed -i "s/title: Gpt Bot/title: $SPACE/" README.md | |
| 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 | |