File size: 1,472 Bytes
bba4fab | 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 61 62 63 64 | #!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
SPACE_REPO="${SPACE_REPO:-evalstate/hf-papers}"
COMMIT_MSG="${COMMIT_MSG:-sync: update community prompt v3 + eval harness}"
DRY_RUN="${DRY_RUN:-0}"
hf auth whoami >/dev/null
mapfile -t MODIFIED < <(git diff --name-only)
mapfile -t UNTRACKED < <(git ls-files --others --exclude-standard)
mapfile -t DELETED < <(git diff --name-only --diff-filter=D)
# Build unique include list
ALL=()
for f in "${MODIFIED[@]}" "${UNTRACKED[@]}"; do
[[ -z "$f" ]] && continue
# Skip noisy/local artifacts by default
if [[ "$f" == *"/__pycache__/"* ]]; then
continue
fi
if [[ "$f" == docs/hf_hub_prompt_ab/*/gpt-oss/raw/* ]]; then
continue
fi
if [[ "$f" == .fast-agent/sessions/* ]]; then
continue
fi
ALL+=("$f")
done
if [[ ${#ALL[@]} -eq 0 && ${#DELETED[@]} -eq 0 ]]; then
echo "[info] nothing to publish"
exit 0
fi
cmd=(hf upload "$SPACE_REPO" . --repo-type space --commit-message "$COMMIT_MSG")
for f in "${ALL[@]}"; do
cmd+=(--include "$f")
done
for f in "${DELETED[@]}"; do
cmd+=(--delete "$f")
done
echo "[info] repo=$SPACE_REPO"
echo "[info] includes=${#ALL[@]} deletes=${#DELETED[@]}"
printf ' + %s\n' "${ALL[@]:0:20}"
if [[ ${#ALL[@]} -gt 20 ]]; then
echo " ..."
fi
if [[ "$DRY_RUN" == "1" ]]; then
echo "[dry-run] ${cmd[*]}"
exit 0
fi
"${cmd[@]}"
echo "[done] published to https://huggingface.co/spaces/${SPACE_REPO}"
|