From 18cb10251425a3d227b0c95264c966cebf14a2d2 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Mon, 20 Jan 2025 15:23:43 +0100 Subject: [PATCH] pass in GH token --- .github/workflows/test_call.yaml | 1 + bioimageio_collection_backoffice/_settings.py | 2 +- bioimageio_collection_backoffice/gh_utils.py | 4 +++- scripts/reupload_old_collection.py | 2 +- scripts/stage.py | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_call.yaml b/.github/workflows/test_call.yaml index 97d40cd3..05ec0c60 100644 --- a/.github/workflows/test_call.yaml +++ b/.github/workflows/test_call.yaml @@ -30,6 +30,7 @@ env: MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}} BIOIMAGEIO_USER_ID: github|${{github.actor_id}} GITHUB_ISSUE_NUMBER: ${{inputs.issue-nr}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} jobs: validate_format: # validate metadata in rdf.yaml diff --git a/bioimageio_collection_backoffice/_settings.py b/bioimageio_collection_backoffice/_settings.py index fd2f1c1b..35fd0ddb 100644 --- a/bioimageio_collection_backoffice/_settings.py +++ b/bioimageio_collection_backoffice/_settings.py @@ -53,7 +53,7 @@ class Settings(BaseSettings, extra="ignore"): s3_secret_access_key: SecretStr = SecretStr("") zenodo_api_access_token: SecretStr = SecretStr("") zenodo_test_api_access_token: SecretStr = SecretStr("") - github_pat: SecretStr = SecretStr("") + github_token: SecretStr = SecretStr("") settings = Settings() diff --git a/bioimageio_collection_backoffice/gh_utils.py b/bioimageio_collection_backoffice/gh_utils.py index 7d56f2cc..87ceea2b 100644 --- a/bioimageio_collection_backoffice/gh_utils.py +++ b/bioimageio_collection_backoffice/gh_utils.py @@ -17,7 +17,9 @@ @cache def get_gh_api(): - return github.Github(auth=github.Auth.Token(settings.github_pat.get_secret_value())) + return github.Github( + auth=github.Auth.Token(settings.github_token.get_secret_value()) + ) @cache diff --git a/scripts/reupload_old_collection.py b/scripts/reupload_old_collection.py index 84dd564c..f31800b4 100644 --- a/scripts/reupload_old_collection.py +++ b/scripts/reupload_old_collection.py @@ -151,7 +151,7 @@ def upload_resources( def workflow_dispatch(workflow_name: str, inputs: Dict[str, str]): - g = github.Github(login_or_token=os.environ["GITHUB_PAT"]) + g = github.Github(login_or_token=os.environ["GITHUB_TOKEN"]) repo = g.get_repo("bioimage-io/collection") diff --git a/scripts/stage.py b/scripts/stage.py index b912da1b..6593ef09 100644 --- a/scripts/stage.py +++ b/scripts/stage.py @@ -8,7 +8,7 @@ def bioimageio_upload(resource_id: str, package_url: str): - g = github.Github(login_or_token=os.environ["GITHUB_PAT"]) + g = github.Github(login_or_token=os.environ["GITHUB_TOKEN"]) repo = g.get_repo("bioimage-io/collection")