2cddf06b6c
Co-authored-by: 旅行呀~ <travelxiao@qq.com>
25 lines
661 B
PowerShell
25 lines
661 B
PowerShell
# Agent-safe: build a commit message with required Co-authored-by trailers.
|
|
# Prints the full message only (no key=value). Never prints tokens.
|
|
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Subject
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
. (Join-Path $PSScriptRoot 'common.ps1')
|
|
|
|
$gitProfile = Get-GitSkillsProfile
|
|
if ($null -eq $gitProfile) {
|
|
Write-Error 'profile_missing'
|
|
exit 1
|
|
}
|
|
|
|
$msg = Format-CommitMessageWithTrailers -Subject $Subject -GitProfile $gitProfile
|
|
# Use LF so Git trailers parse consistently on Windows.
|
|
$msg = $msg -replace "`r`n", "`n"
|
|
[Console]::Out.Write($msg)
|
|
if (-not $msg.EndsWith("`n")) {
|
|
[Console]::Out.Write("`n")
|
|
}
|