Skip to content

Commit e4c6078

Browse files
Data upload is missing HF token (#273)
* Data upload is missing HF token Fixes #272 * Format
1 parent cdae03f commit e4c6078

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: patch
2+
changes:
3+
fixed:
4+
- Missing HF token.

policyengine_us_data/utils/data_upload.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from importlib import metadata
77
import google.auth
88
import logging
9+
import os
910

1011

1112
def upload_data_files(
@@ -44,6 +45,9 @@ def upload_files_to_hf(
4445
api = HfApi()
4546
hf_operations = []
4647

48+
token = os.environ.get(
49+
"HUGGING_FACE_TOKEN",
50+
)
4751
for file_path in files:
4852
file_path = Path(file_path)
4953
if not file_path.exists():
@@ -55,6 +59,7 @@ def upload_files_to_hf(
5559
)
5660
)
5761
commit_info = api.create_commit(
62+
token=token,
5863
repo_id=hf_repo_name,
5964
operations=hf_operations,
6065
repo_type=hf_repo_type,
@@ -64,6 +69,7 @@ def upload_files_to_hf(
6469

6570
# Tag commit with version
6671
api.create_tag(
72+
token=token,
6773
repo_id=hf_repo_name,
6874
tag=version,
6975
revision=commit_info.oid,

0 commit comments

Comments
 (0)