NuGet lock files; report and debug log per run in reports/<timestamp>/

This commit is contained in:
Demo committed 2026-10-11 21:22:32 +02:00
1 parent 32d194743e
commit f25441ffdc
5 files changed
+301 -6

No files matched your search

+12 -3
View File
@@ -16,6 +16,9 @@ $ts = $now.ToString('yyyy-MM-dd-HH-mm-ss-fff') # for the branch name (no
$prTimestamp = $now.ToString('yyyy-MM-dd HH:mm:ss.fff') # for the PR title
$gitUrl = $endpoint -replace '://', "://renovate:$token@"
$gitUrl = "$gitUrl/$repo.git"
# Report and debug log of this run: reports/<timestamp>/
$outDir = Join-Path (Join-Path (Join-Path $PSScriptRoot '..') 'reports') $ts
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
Push-Location (Join-Path $PSScriptRoot '..') # repository root
# 1. Push the local state of main to Forgejo (without credential helper, the credentials are in the URL)
@@ -24,20 +27,26 @@ if ($LASTEXITCODE -ne 0) { Pop-Location; throw 'git push failed' }
# 2. Run Renovate. Branch prefix with timestamp => every run creates new branches + PRs.
# branch-prefix-old prevents Renovate from reusing branches of previous runs.
# Via environment variables: the commit author and the timestamp in the PR title (commitMessageSuffix has no CLI flag).
# Via environment variables: the commit author, the timestamp in the PR title (commitMessageSuffix has no CLI flag)
# and the debug log file (console output in the same format, but at debug level).
$env:RENOVATE_GIT_AUTHOR = 'Renovate Bot <renovate@localhost>'
$env:RENOVATE_COMMIT_MESSAGE_SUFFIX = $prTimestamp
$env:LOG_FILE = Join-Path $outDir 'renovate.log'
$env:LOG_FILE_LEVEL = 'debug'
$env:LOG_FILE_FORMAT = 'pretty'
npx --yes renovate@44.149.3 `
--platform=forgejo --endpoint="$endpoint/api/v1" --token=$token `
--branch-prefix="renovate/$ts-" --branch-prefix-old="renovate/$ts-" `
--report-type=file --report-path="$(Join-Path $outDir 'renovate-report.json')" `
$repo
$renovateExitCode = $LASTEXITCODE
Remove-Item Env:RENOVATE_GIT_AUTHOR, Env:RENOVATE_COMMIT_MESSAGE_SUFFIX
if ($renovateExitCode -ne 0) { Pop-Location; throw 'Renovate failed' }
Remove-Item Env:RENOVATE_GIT_AUTHOR, Env:RENOVATE_COMMIT_MESSAGE_SUFFIX, Env:LOG_FILE, Env:LOG_FILE_LEVEL, Env:LOG_FILE_FORMAT
if ($renovateExitCode -ne 0) { Pop-Location; throw "Renovate failed - see $outDir" }
# 3. Fetch the Renovate branches into the local repository (as forgejo/renovate/...)
git -c credential.helper= fetch -q --prune $gitUrl '+refs/heads/renovate/*:refs/remotes/forgejo/renovate/*'
Write-Host "`nNew branches:" -ForegroundColor Cyan
git branch -r --list "forgejo/renovate/$ts-*"
Write-Host "PRs: $endpoint/$repo/pulls (login: renovate / renovate)"
Write-Host "Report and debug log: $outDir"
Pop-Location