diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..583f16e7 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + fixed: + - Missing HF token. diff --git a/policyengine_us_data/utils/data_upload.py b/policyengine_us_data/utils/data_upload.py index 721c4c77..7e84a2d7 100644 --- a/policyengine_us_data/utils/data_upload.py +++ b/policyengine_us_data/utils/data_upload.py @@ -6,6 +6,7 @@ from importlib import metadata import google.auth import logging +import os def upload_data_files( @@ -44,6 +45,9 @@ def upload_files_to_hf( api = HfApi() hf_operations = [] + token = os.environ.get( + "HUGGING_FACE_TOKEN", + ) for file_path in files: file_path = Path(file_path) if not file_path.exists(): @@ -55,6 +59,7 @@ def upload_files_to_hf( ) ) commit_info = api.create_commit( + token=token, repo_id=hf_repo_name, operations=hf_operations, repo_type=hf_repo_type, @@ -64,6 +69,7 @@ def upload_files_to_hf( # Tag commit with version api.create_tag( + token=token, repo_id=hf_repo_name, tag=version, revision=commit_info.oid,