Skip to content

Commit d412459

Browse files
committed
add a explicit tokn login
1 parent 6fd0e91 commit d412459

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/deploy_to_hf.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,14 +505,21 @@ fi
505505

506506
echo "🔑 Ensuring Hugging Face authentication..."
507507

508-
# In GitHub Actions, HF CLI automatically uses HF_TOKEN env var
508+
# In GitHub Actions, explicitly authenticate with token
509509
if [ "$IS_GITHUB_ACTIONS" = true ]; then
510510
if [ -z "${HF_TOKEN:-}" ]; then
511511
echo "Error: HF_TOKEN secret is required in GitHub Actions" >&2
512512
echo "Please set the HF_TOKEN secret in repository settings" >&2
513513
exit 1
514514
fi
515-
echo "Using HF_TOKEN from GitHub Actions environment"
515+
echo "Authenticating with HF_TOKEN..."
516+
LOGIN_OUTPUT=$(hf auth login --token "$HF_TOKEN" 2>&1)
517+
LOGIN_EXIT_CODE=$?
518+
if [ $LOGIN_EXIT_CODE -ne 0 ]; then
519+
echo "Error: Failed to authenticate with HF_TOKEN" >&2
520+
echo "$LOGIN_OUTPUT" >&2
521+
exit 1
522+
fi
516523
elif [ -n "${HF_TOKEN:-}" ]; then
517524
# In local environment, try to use HF_TOKEN if set
518525
hf auth login --token "$HF_TOKEN" --add-to-git-credential >/dev/null 2>&1 || true

0 commit comments

Comments
 (0)