Claude commited on
Add HF_TOKEN preflight + LICENSE + ignore build artifacts
Browse files- Sync workflow now fails fast with a human-readable error if
HF_TOKEN is missing, malformed, or rejected by HF's whoami, so
token-rotation regressions surface in 2 lines instead of 40.
- Add MIT LICENSE file (pyproject already declares MIT but the
file itself was missing, which bare-sdist consumers and some
lints flag).
- Ignore `build/` and `dist/` so release artifacts don't pollute
the working tree.
- .github/workflows/sync-to-hf-space.yml +39 -0
- .gitignore +2 -0
- LICENSE +21 -0
.github/workflows/sync-to-hf-space.yml
CHANGED
|
@@ -26,6 +26,45 @@ jobs:
|
|
| 26 |
fetch-depth: 0
|
| 27 |
lfs: true
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
- name: Push to Hugging Face Space
|
| 30 |
env:
|
| 31 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
|
|
| 26 |
fetch-depth: 0
|
| 27 |
lfs: true
|
| 28 |
|
| 29 |
+
# Fail fast with a human-readable message if HF_TOKEN is missing or
|
| 30 |
+
# obviously invalid, rather than letting `git push` die with a cryptic
|
| 31 |
+
# "Authentication required" 40 lines into the log.
|
| 32 |
+
- name: Preflight — HF_TOKEN sanity check
|
| 33 |
+
env:
|
| 34 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 35 |
+
run: |
|
| 36 |
+
if [ -z "${HF_TOKEN}" ]; then
|
| 37 |
+
echo "::error::HF_TOKEN secret is not set on this repository."
|
| 38 |
+
echo "Create a Write-scope token at https://huggingface.co/settings/tokens"
|
| 39 |
+
echo "and add it as a repo secret named HF_TOKEN (Settings → Secrets → Actions)."
|
| 40 |
+
exit 1
|
| 41 |
+
fi
|
| 42 |
+
# Real HF user tokens start with `hf_` and are >=20 chars. This
|
| 43 |
+
# catches pasted-in empties/quotes without hitting the API.
|
| 44 |
+
case "${HF_TOKEN}" in
|
| 45 |
+
hf_*) : ;;
|
| 46 |
+
*)
|
| 47 |
+
echo "::error::HF_TOKEN does not look like a Hugging Face user token (expected prefix 'hf_')."
|
| 48 |
+
echo "Regenerate at https://huggingface.co/settings/tokens with Write scope."
|
| 49 |
+
exit 1
|
| 50 |
+
;;
|
| 51 |
+
esac
|
| 52 |
+
if [ "${#HF_TOKEN}" -lt 20 ]; then
|
| 53 |
+
echo "::error::HF_TOKEN is suspiciously short (${#HF_TOKEN} chars) — likely truncated."
|
| 54 |
+
exit 1
|
| 55 |
+
fi
|
| 56 |
+
# Verify the token is actually accepted by HF's whoami endpoint
|
| 57 |
+
# before we try to push. Saves wading through git's auth output.
|
| 58 |
+
http_code=$(curl -s -o /tmp/hf_whoami.json -w "%{http_code}" \
|
| 59 |
+
-H "Authorization: Bearer ${HF_TOKEN}" \
|
| 60 |
+
https://huggingface.co/api/whoami-v2)
|
| 61 |
+
if [ "${http_code}" != "200" ]; then
|
| 62 |
+
echo "::error::HF whoami returned ${http_code}. Token is invalid or revoked."
|
| 63 |
+
echo "Regenerate at https://huggingface.co/settings/tokens with Write scope."
|
| 64 |
+
exit 1
|
| 65 |
+
fi
|
| 66 |
+
echo "HF_TOKEN looks good (whoami returned 200)."
|
| 67 |
+
|
| 68 |
- name: Push to Hugging Face Space
|
| 69 |
env:
|
| 70 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
.gitignore
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
__pycache__/
|
| 2 |
*.py[cod]
|
| 3 |
*.egg-info/
|
|
|
|
|
|
|
| 4 |
.venv/
|
| 5 |
venv/
|
| 6 |
.env
|
|
|
|
| 1 |
__pycache__/
|
| 2 |
*.py[cod]
|
| 3 |
*.egg-info/
|
| 4 |
+
build/
|
| 5 |
+
dist/
|
| 6 |
.venv/
|
| 7 |
venv/
|
| 8 |
.env
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 QCal Copilot contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|