Spaces:
Running
Running
set -e | |
if [ -z "$sc4sc_token" ]; then | |
echo "Error: Environment variable sc4sc_token is not set." | |
exit 1 | |
fi | |
# Gitが安全と認識するようにする(必要最低限の変更) | |
git config --global --add safe.directory /app | |
SPACE_REPO="sc4sc/editor" | |
GIT_URL="https://hf_$sc4sc_token@huggingface.co/spaces/$SPACE_REPO" | |
# Gitリポジトリが未初期化なら初期化 | |
if [ ! -d ".git" ]; then | |
git init | |
git remote add origin "$GIT_URL" | |
fi | |
git add . | |
git commit -m "Automated update" || echo "Nothing to commit" | |
git push origin main | |
echo "✅ Space successfully updated." | |