diff --git a/python/pytest_plugins/github_secrets/github_secrets/plugin.py b/python/pytest_plugins/github_secrets/github_secrets/plugin.py index c911d535..0f748d01 100644 --- a/python/pytest_plugins/github_secrets/github_secrets/plugin.py +++ b/python/pytest_plugins/github_secrets/github_secrets/plugin.py @@ -1,8 +1,11 @@ import ast +import logging import os import pytest +logger = logging.getLogger(__name__) + @pytest.fixture(scope="session") def github_secrets() -> dict[str, str]: @@ -25,4 +28,9 @@ def github_secrets() -> dict[str, str]: raise Exception( "Invalid format for `SECRETS_FROM_GITHUB`—must be a Python dict[str, str]" ) + if set(secrets.values()) == {""}: + logger.warning( + "No GitHub secrets available: skipping tests that require GitHub secrets" + ) + pytest.skip("Running on fork: no access to GitHub secrets") return secrets