File size: 1,078 Bytes
d6b0a9e
 
a3edfab
9a74a7d
a3edfab
 
 
d6b0a9e
 
 
 
 
9a74a7d
d6b0a9e
a3edfab
 
d6b0a9e
 
 
 
 
 
 
 
 
 
 
 
 
 
a3edfab
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
#!/usr/bin/env bash
# Push main to staging HF Space and patch its title/color.
#
# README.md in git stays prod-canonical (title: NowAI-Bench, colorFrom: indigo).
# After each push, huggingface_hub.metadata_update() commits a README patch
# directly on the staging Space. We force-push on the next run to overwrite it,
# so that commit never needs to be merged locally.
set -euo pipefail

STAGING_REMOTE="origin"
STAGING_SPACE="ServiceNow-AI/NowAI-Bench-Staging"
STAGING_TITLE="NowAI-Bench Staging"
STAGING_COLOR="red"

echo "→ Force-pushing to staging (overwrites prior metadata patch)..."
git push --force "$STAGING_REMOTE" main

echo "→ Patching staging Space metadata..."
python3 - <<PYEOF
from huggingface_hub import metadata_update
url = metadata_update(
    "$STAGING_SPACE",
    {"title": "$STAGING_TITLE", "colorFrom": "$STAGING_COLOR"},
    repo_type="space",
    overwrite=True,
)
print(f"  committed: {url}")
PYEOF

echo "✓ Staging Space ready: https://huggingface.co/spaces/${STAGING_SPACE}"
echo "  (staging remote is now 1 commit ahead — that's expected)"