Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(config): refactors default token resolution to prevent insecure URL error #1173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions 18 src/semantic_release/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
ParserLoadError,
)
from semantic_release.helpers import dynamic_import
from semantic_release.hvcs.remote_hvcs_base import RemoteHvcsBase
from semantic_release.version.declaration import (
PatternVersionDeclaration,
TomlVersionDeclaration,
Expand Down Expand Up @@ -287,15 +286,18 @@ def set_default_token(self) -> Self:

def _get_default_token(self) -> str | None:
hvcs_client_class = _known_hvcs[self.type]
default_hvcs_instance = hvcs_client_class("git@example.com:owner/project.git")
if not isinstance(default_hvcs_instance, RemoteHvcsBase):
return None

default_token_name = default_hvcs_instance.DEFAULT_ENV_TOKEN_NAME
if not default_token_name:
return None
default_token_name = (
getattr(hvcs_client_class, "DEFAULT_ENV_TOKEN_NAME") # noqa: B009
if hasattr(hvcs_client_class, "DEFAULT_ENV_TOKEN_NAME")
else ""
)

return EnvConfigVar(env=default_token_name).getvalue()
return (
EnvConfigVar(env=default_token_name).getvalue()
if default_token_name
else None
)

@model_validator(mode="after")
def check_url_scheme(self) -> Self:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.