UdasriHasindu commited on
Commit
7575b09
·
1 Parent(s): ca58c12

fix: actions

Browse files
.github/workflows/deploy-hf-space.yml CHANGED
@@ -24,10 +24,17 @@ jobs:
24
  env:
25
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
26
  run: |
27
- if [ -z "${HF_TOKEN}" ]; then
28
- echo "HF_TOKEN secret is missing"
 
 
 
 
29
  exit 1
30
  fi
31
 
32
- git remote add hf "https://oauth2:${HF_TOKEN}@huggingface.co/spaces/xplorers/GAIT_API"
33
- git push --force hf HEAD:main
 
 
 
 
24
  env:
25
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
26
  run: |
27
+ set -euo pipefail
28
+
29
+ HF_TOKEN_CLEAN="$(printf '%s' "${HF_TOKEN}" | tr -d '\r\n' | xargs)"
30
+
31
+ if [ -z "${HF_TOKEN_CLEAN}" ]; then
32
+ echo "HF_TOKEN secret is missing/empty after trimming"
33
  exit 1
34
  fi
35
 
36
+ git remote remove hf 2>/dev/null || true
37
+ git remote add hf "https://huggingface.co/spaces/xplorers/GAIT_API"
38
+
39
+ git -c http.extraheader="Authorization: Bearer ${HF_TOKEN_CLEAN}" \
40
+ push --force hf HEAD:main