Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

fix(cmd-version): prevent errors when PSR is executed in non-GitHub CI environments#1322

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall 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
9 changes: 3 additions & 6 deletionssrc/semantic_release/cli/commands/version.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -471,11 +471,7 @@ def version( # noqa: C901
no_verify = runtime.no_git_verify
opts = runtime.global_cli_options
gha_output = VersionGitHubActionsOutput(
gh_client=(
hvcs_client
if isinstance(hvcs_client, Github)
else Github(hvcs_client.remote_url(use_token=False))
),
gh_client=hvcs_client if isinstance(hvcs_client, Github) else None,
mode=(
PersistenceMode.TEMPORARY
if opts.noop or (not commit_changes and not create_tag)
Expand DownExpand Up@@ -553,7 +549,8 @@ def version( # noqa: C901

# Update GitHub Actions output value with new version & set delayed write
gha_output.version = new_version
ctx.call_on_close(gha_output.write_if_possible)
if isinstance(hvcs_client, Github):
ctx.call_on_close(gha_output.write_if_possible)

# Make string variant of version or appropriate tag as necessary
version_to_print = str(new_version) if not print_only_tag else new_version.as_tag()
Expand Down
10 changes: 8 additions & 2 deletionssrc/semantic_release/cli/github_actions_output.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,7 @@ class VersionGitHubActionsOutput:

def __init__(
self,
gh_client: Github,
gh_client: Github | None = None,
mode: PersistenceMode = PersistenceMode.PERMANENT,
released: bool | None = None,
version: Version | None = None,
Expand DownExpand Up@@ -106,6 +106,12 @@ def prev_version(self, value: Version) -> None:
raise TypeError("output 'prev_version' should be a Version")
self._prev_version = value

@property
def gh_client(self) -> Github:
if not self._gh_client:
raise ValueError("GitHub client not set, cannot create links")
return self._gh_client

def to_output_text(self) -> str:
missing: set[str] = set()
if self.version is None:
Expand All@@ -128,7 +134,7 @@ def to_output_text(self) -> str:
"version": str(self.version),
"tag": self.tag,
"is_prerelease": str(self.is_prerelease).lower(),
"link": self._gh_client.create_release_url(self.tag) if self.tag else "",
"link": self.gh_client.create_release_url(self.tag) if self.tag else "",
"previous_version": str(self.prev_version) if self.prev_version else "",
"commit_sha": self.commit_sha if self.commit_sha else "",
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp