Add `signoff_commit` config option to sign off version commits (DCO support) by Copilot · Pull Request #1492 · python-semantic-release/python-semantic-release · GitHub
Skip to content
Draft
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions docs/configuration/configuration.rst
2 changes: 2 additions & 0 deletions src/semantic_release/cli/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ def version( # noqa: C901
commit_message = runtime.commit_message
major_on_zero = runtime.major_on_zero
no_verify = runtime.no_git_verify
signoff_commit = runtime.signoff_commit
opts = runtime.global_cli_options
add_partial_tags = config.add_partial_tags
gha_output = VersionGitHubActionsOutput(
Expand Down Expand Up @@ -713,6 +714,7 @@ def version( # noqa: C901
message=commit_message.format(version=new_version),
date=int(commit_date.timestamp()),
no_verify=no_verify,
signoff=signoff_commit,
noop=opts.noop,
)
except GitCommitEmptyIndexError:
Expand Down
3 changes: 3 additions & 0 deletions src/semantic_release/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ class RawConfig(BaseModel):
repo_dir: Path = Field(default=cast("Path", "."), validate_default=True)
remote: RemoteConfig = RemoteConfig()
no_git_verify: bool = False
signoff_commit: bool = False
tag_format: str = "v{version}"
add_partial_tags: bool = False
publish: PublishConfig = PublishConfig()
Expand Down Expand Up @@ -635,6 +636,7 @@ class RuntimeContext:
allow_zero_version: bool
prerelease: bool
no_git_verify: bool
signoff_commit: bool
assets: List[str]
commit_author: Actor
commit_message: str
Expand Down Expand Up @@ -986,6 +988,7 @@ def from_raw_config( # noqa: C901
global_cli_options=global_cli_options,
masker=masker,
no_git_verify=raw.no_git_verify,
signoff_commit=raw.signoff_commit,
)
# credential masker
self.apply_log_masking(self.masker)
Expand Down
3 changes: 3 additions & 0 deletions src/semantic_release/gitproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def git_commit(
date: int | None = None,
commit_all: bool = False,
no_verify: bool = False,
signoff: bool = False,
noop: bool = False,
) -> None:
git_args = dict(
Expand All @@ -184,6 +185,7 @@ def git_commit(
"m": message,
"date": date,
"no_verify": no_verify,
"signoff": signoff,
}.items(),
)
)
Expand All @@ -209,6 +211,7 @@ def git_commit(
command += f"git commit -m '{indented_commit_message}'"
command += "--all" if commit_all else ""
command += "--no-verify" if no_verify else ""
command += "--signoff" if signoff else ""

noop_report(
indented(
Expand Down
55 changes: 55 additions & 0 deletions tests/e2e/cmd_version/test_version.py