changed.修改了PLONDS上传逻辑

This commit is contained in:
lincube
2026-06-01 16:53:23 +08:00
parent a2ac302ee7
commit 131043fe37
17 changed files with 1370 additions and 593 deletions

92
analyze_commits.ps1 Normal file
View File

@@ -0,0 +1,92 @@
# 分析当天的 Git 提交并生成 Markdown 报告
$todayStart = [DateTime]::Today
$todayEnd = [DateTime]::Now
$outputDir = "docs\auto_commit_md"
# 创建输出目录(如果不存在)
if (-not (Test-Path $outputDir)) {
New-Item -ItemType Directory -Path $outputDir -Force | Out-Null
Write-Host "创建目录: $outputDir"
}
# 获取当天的所有提交
Write-Host "正在获取 $todayStart$todayEnd 之间的提交..."
$commits = git log --since="$($todayStart.ToString("yyyy-MM-dd HH:mm:ss"))" --until="$($todayEnd.ToString("yyyy-MM-dd HH:mm:ss"))" --pretty=format:"%H|%an|%ai|%s"
if ([string]::IsNullOrWhiteSpace($commits)) {
Write-Host "当天没有新的提交。"
exit 0
}
Write-Host "找到 $($commits.Split([Environment]::NewLine).Count) 个提交"
# 处理每个提交
$commitLines = $commits -split [Environment]::NewLine
foreach ($line in $commitLines) {
if ([string]::IsNullOrWhiteSpace($line)) { continue }
$parts = $line -split '\|', 4
$hash = $parts[0]
$author = $parts[1]
$date = $parts[2]
$message = $parts[3]
$shortHash = $hash.Substring(0, 7)
$dateStr = [DateTime]::Parse($date).ToString("yyyyMMdd")
$outputFile = Join-Path $outputDir "${dateStr}_${shortHash}.md"
Write-Host "处理提交: $shortHash - $message"
# 获取详细的 diff
$diff = git show --stat --stat-width=120 --stat-name-width=80 $hash
$fullDiff = git show $hash
# 构建 Markdown 内容
$markdown = @"
# Git
##
| | |
|------|------|
| **** | $hash |
| **** | $shortHash |
| **** | $author |
| **** | $date |
##
$message
##
``````
$diff
``````
##
``````diff
$fullDiff
``````
##
>
-
- bug
-
-
---
*: $(Get-Date -Format "yyyy-MM-dd HH:mm:ss")*
"@
# 保存文件
$markdown | Out-File -FilePath $outputFile -Encoding UTF8
Write-Host "已保存: $outputFile"
}
Write-Host "`n完成!共生成 $($commitLines.Count) 份报告。"