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(github-actions): refactor the action output error checking for non-release executions#1308

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
18 changes: 14 additions & 4 deletionssrc/semantic_release/cli/commands/version.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,10 @@
generate_release_notes,
write_changelog_files,
)
from semantic_release.cli.github_actions_output import VersionGitHubActionsOutput
from semantic_release.cli.github_actions_output import (
PersistenceMode,
VersionGitHubActionsOutput,
)
from semantic_release.cli.util import noop_report, rprint
from semantic_release.const import DEFAULT_SHELL, DEFAULT_VERSION
from semantic_release.enums import LevelBump
Expand DownExpand Up@@ -468,9 +471,16 @@ def version( # noqa: C901
no_verify = runtime.no_git_verify
opts = runtime.global_cli_options
gha_output = VersionGitHubActionsOutput(
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 Github(hvcs_client.remote_url(use_token=False))
),
mode=(
PersistenceMode.TEMPORARY
if opts.noop or (not commit_changes and not create_tag)
else PersistenceMode.PERMANENT
),
released=False,
)

Expand Down
17 changes: 13 additions & 4 deletionssrc/semantic_release/cli/github_actions_output.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
from enum import Enum
from re import compile as regexp
from typing import TYPE_CHECKING

Expand All@@ -13,19 +14,26 @@
from semantic_release.hvcs.github import Github


class PersistenceMode(Enum):
TEMPORARY = "temporary"
PERMANENT = "permanent"


class VersionGitHubActionsOutput:
OUTPUT_ENV_VAR = "GITHUB_OUTPUT"

def __init__(
self,
gh_client: Github,
mode: PersistenceMode = PersistenceMode.PERMANENT,
released: bool | None = None,
version: Version | None = None,
commit_sha: str | None = None,
release_notes: str | None = None,
prev_version: Version | None = None,
) -> None:
self._gh_client = gh_client
self._mode = mode
self._released = released
self._version = version
self._commit_sha = commit_sha
Expand DownExpand Up@@ -104,10 +112,11 @@ def to_output_text(self) -> str:
missing.add("version")
if self.released is None:
missing.add("released")
if self.released and self.commit_sha is None:
missing.add("commit_sha")
if self.released and self.release_notes is None:
missing.add("release_notes")
if self.released:
if self.release_notes is None:
missing.add("release_notes")
if self._mode is PersistenceMode.PERMANENT and self.commit_sha is None:
missing.add("commit_sha")

if missing:
raise ValueError(
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp