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

chore: fix implement --no-verify git commit option and fix gitlab hvc…#727

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

Closed
Closed
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
3 changes: 3 additions & 0 deletionssemantic_release/cli/commands/version.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -285,6 +285,7 @@ def version( # noqa: C901
commit_author = runtime.commit_author
commit_message = runtime.commit_message
major_on_zero = runtime.major_on_zero
no_verify = runtime.no_verify
build_command = runtime.build_command
opts = runtime.global_cli_options
gha_output = VersionGitHubActionsOutput()
Expand DownExpand Up@@ -529,6 +530,7 @@ def custom_git_environment() -> ContextManager[None]:
)

command += f"git commit -m '{indented_commit_message}'"
command += "--no-verify" if no_verify else ""

noop_report(
indented(
Expand All@@ -544,6 +546,7 @@ def custom_git_environment() -> ContextManager[None]:
repo.git.commit(
m=commit_message.format(version=new_version),
date=int(commit_date.timestamp()),
no_verify=no_verify,
)

# Run the tagging after potentially creating a new HEAD commit.
Expand Down
3 changes: 3 additions & 0 deletionssemantic_release/cli/config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -210,6 +210,7 @@ class RawConfig(BaseModel):
major_on_zero: bool = True
allow_zero_version: bool = True
remote: RemoteConfig = RemoteConfig()
no_verify: bool = False
tag_format: str = "v{version}"
publish: PublishConfig = PublishConfig()
version_toml: Optional[Tuple[str, ...]] = None
Expand DownExpand Up@@ -295,6 +296,7 @@ class RuntimeContext:
major_on_zero: bool
allow_zero_version: bool
prerelease: bool
no_verify: bool
assets: List[str]
commit_author: Actor
commit_message: str
Expand DownExpand Up@@ -488,6 +490,7 @@ def from_raw_config(
upload_to_vcs_release=raw.publish.upload_to_vcs_release,
global_cli_options=global_cli_options,
masker=masker,
no_verify=raw.no_verify,
)
# credential masker
self.apply_log_masking(self.masker)
Expand Down
9 changes: 5 additions & 4 deletionssemantic_release/hvcs/github.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -238,7 +238,7 @@ def edit_release_notes(self, release_id: int, release_notes: str) -> int:
"""
Edit a release with updated change notes
https://docs.github.com/rest/reference/repos#update-a-release
:paramid: ID of release to update
:paramrelease_id: ID of release to update
:param release_notes: The release notes for this version
:return: The ID of the release that was edited
"""
Expand All@@ -263,8 +263,9 @@ def create_or_update_release(
) -> int:
"""
Post release changelog
:paramversion: The version number
:paramtag: The version number
:param release_notes: The release notes for this version
:param prerelease: Whether or not this release should be created as a prerelease
:return: The status of the request
"""
log.info("Creating release for %s", tag)
Expand DownExpand Up@@ -361,8 +362,8 @@ def upload_asset(
def upload_dists(self, tag: str, dist_glob: str) -> int:
"""
Upload distributions to a release
:paramversion: Version to upload for
:parampath: Path to the dist directory
:paramtag: Version to upload for
:paramdist_glob: Path to the dist directory
:return: The number of distributions successfully uploaded
"""
# Find the release corresponding to this version
Expand Down
29 changes: 27 additions & 2 deletionssemantic_release/hvcs/gitlab.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@

from semantic_release.helpers import logged_function
from semantic_release.hvcs._base import HvcsBase
from semantic_release.hvcs.util import suppress_not_found

if TYPE_CHECKING:
from typing import Any
Expand DownExpand Up@@ -45,7 +46,6 @@ def __init__(
**kwargs: Any,
) -> None:
super().__init__(remote_url)
self._remote_url = remote_url
self.token = token

domain_url = parse_url(
Expand DownExpand Up@@ -113,12 +113,29 @@ def create_release(
{
"name": "Release " + tag,
"tag_name": tag,
"tag_message": release_notes[0:72],
"description": release_notes,
}
)
log.info("Successfully created release for %s", tag)
return tag

@logged_function(log)
@suppress_not_found
def get_release_id_by_tag(self, tag: str) -> int | None:
"""
Get a release by its tag name
https://docs.github.com/rest/reference/repos#get-a-release-by-tag-name
:param tag: Tag to get release for
:return: ID of release, if found, else None
"""
client = gitlab.Gitlab(self.hvcs_domain.url, private_token=self.token)
client.auth()
proj_release = client.projects.get(self.owner + "/" + self.repo_name).releases.get(
tag
)
return proj_release.asdict().get("commit.id")

# TODO: make str types accepted here
@logged_function(log)
def edit_release_notes( # type: ignore[override]
Expand DownExpand Up@@ -153,7 +170,15 @@ def create_or_update_release(
self.owner,
self.repo_name,
)
return self.edit_release_notes(release_id=tag, release_notes=release_notes)
release_commit_id = self.get_release_id_by_tag(tag)
if release_commit_id is None:
raise ValueError(
f"release commit id for tag {tag} not found, and could not be created"
)

log.debug("Found existing release commit %s, updating", release_commit_id)
# If this errors we let it die
return self.edit_release_notes(release_id=tag, release_notes=release_notes)

def compare_url(self, from_rev: str, to_rev: str) -> str:
return self.create_server_url(
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp