56 lines
2.7 KiB
PowerShell
56 lines
2.7 KiB
PowerShell
# Check only: Renovate runs with the "local" platform directly on this repository
|
|
# and changes nothing. Found updates are read from the JSON report and printed.
|
|
# Everything about the run is stored in renovate/results/<timestamp>/:
|
|
# command.ps1 the Renovate command that was executed (incl. environment variables)
|
|
# renovate.json the Renovate configuration that was used (working directory)
|
|
# renovate.log console output at debug level
|
|
# renovate-report.json Renovate report
|
|
# info.json start, end and duration
|
|
# Renovate requires Node.js >= 24.11
|
|
if ([version](node -v).TrimStart('v') -lt [version]'24.11.0') { throw "Renovate requires Node.js >= 24.11, found: $(node -v). E.g.: volta install node@24" }
|
|
|
|
$startedAt = Get-Date
|
|
$ts = $startedAt.ToString('yyyy-MM-dd-HH-mm-ss-fff')
|
|
Push-Location (Join-Path $PSScriptRoot '../..') # repository root
|
|
$outDir = "renovate/results/$ts"
|
|
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
|
|
# The local platform reads the working directory, so store the renovate.json from there
|
|
Copy-Item renovate.json "$outDir/renovate.json"
|
|
|
|
# Write the Renovate command to command.ps1 and run it.
|
|
# LOG_FILE is relative on purpose: Renovate lowercases it, an absolute path would break on case-sensitive file systems.
|
|
$command = @'
|
|
# Renovate command of run __TS__ - run it from the repository root to repeat it
|
|
$env:LOG_FILE = 'renovate/results/__TS__/renovate.log'
|
|
$env:LOG_FILE_LEVEL = 'debug'
|
|
$env:LOG_FILE_FORMAT = 'pretty'
|
|
npx --yes renovate@44.149.3 `
|
|
--platform=local --dry-run=lookup `
|
|
--report-type=file --report-path=renovate/results/__TS__/renovate-report.json
|
|
'@
|
|
$command = $command.Replace('__TS__', $ts)
|
|
Set-Content -Path "$outDir/command.ps1" -Value $command
|
|
& "./$outDir/command.ps1"
|
|
Remove-Item Env:LOG_FILE, Env:LOG_FILE_LEVEL, Env:LOG_FILE_FORMAT
|
|
|
|
$finishedAt = Get-Date
|
|
[ordered]@{
|
|
startedAt = $startedAt.ToString('yyyy-MM-ddTHH:mm:ss.fffzzz')
|
|
finishedAt = $finishedAt.ToString('yyyy-MM-ddTHH:mm:ss.fffzzz')
|
|
durationSeconds = [math]::Round(($finishedAt - $startedAt).TotalSeconds, 1)
|
|
} | ConvertTo-Json | Set-Content -Path "$outDir/info.json"
|
|
|
|
Write-Host "`nAvailable updates:" -ForegroundColor Cyan
|
|
$packageFiles = (Get-Content "$outDir/renovate-report.json" -Raw -Encoding UTF8 | ConvertFrom-Json).repositories.local.packageFiles
|
|
foreach ($manager in $packageFiles.PSObject.Properties) {
|
|
foreach ($file in $manager.Value) {
|
|
foreach ($dep in $file.deps) {
|
|
foreach ($update in $dep.updates) {
|
|
Write-Host " [$($manager.Name)] $($file.packageFile): $($dep.depName) $($dep.currentValue) -> $($update.newValue) ($($update.updateType))"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Write-Host "Run details: $outDir"
|
|
Pop-Location
|