Spaces:
Runtime error
Runtime error
| # Hard-push GitHub HEAD → build-small-hackathon/plane-mode-scholar ONLY. | |
| # This is the hackathon submission Space — run this when you need org README updated. | |
| # | |
| # Usage: | |
| # export HF_TOKEN=hf_... # write token from GuusBouwensNL account | |
| # ./scripts/push_org_space.sh | |
| set -euo pipefail | |
| HF_USER="${PMS_HF_USER:-GuusBouwensNL}" | |
| ORG_REPO="build-small-hackathon/plane-mode-scholar" | |
| if [[ -z "${HF_TOKEN:-}" ]]; then | |
| echo "ERROR: Set HF_TOKEN (write token for ${HF_USER})" | |
| echo " export HF_TOKEN=hf_..." | |
| exit 1 | |
| fi | |
| # Trim accidental whitespace/newlines from pasted tokens | |
| HF_TOKEN="$(printf '%s' "$HF_TOKEN" | tr -d '\n\r ')" | |
| ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
| cd "$ROOT" | |
| SHA=$(git rev-parse --short HEAD) | |
| ORIG_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
| cleanup() { | |
| git checkout -f "$ORIG_BRANCH" >/dev/null 2>&1 || true | |
| git branch -D hf-deploy >/dev/null 2>&1 || true | |
| } | |
| trap cleanup EXIT | |
| git config user.email "sync@plane-mode-scholar" | |
| git config user.name "PMS Sync" | |
| git checkout --orphan hf-deploy | |
| git add -A | |
| git commit -q -m "Deploy $SHA (flattened for HF Spaces)" | |
| url="https://${HF_USER}:${HF_TOKEN}@huggingface.co/spaces/${ORG_REPO}" | |
| echo "Force-pushing $SHA → https://huggingface.co/spaces/${ORG_REPO}" | |
| for attempt in 1 2 3 4 5; do | |
| if git push --force "$url" hf-deploy:main; then | |
| echo "OK: pushed to ${ORG_REPO}" | |
| python3 scripts/verify_org_space.py || true | |
| exit 0 | |
| fi | |
| echo "Push failed (attempt $attempt), retry in $((attempt * 4))s..." | |
| sleep $((attempt * 4)) | |
| done | |
| echo "ERROR: push to ${ORG_REPO} failed after 5 attempts" | |
| exit 1 | |