Created
June 1, 2025 04:29
-
-
Save milnak/09a672b7df664d4c69f41420c7d92ac6 to your computer and use it in GitHub Desktop.
Show release notes for installed scoop apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
# Show release notes (if available) for scoop apps updated within n days. | |
[int]$NumberOfDays = 2, | |
# Auth Token to avoid github rate limiting. | |
# (Not yet implemented) | |
[string]$AuthToken | |
) | |
# TODO: Pass in auth info: | |
# $authorization = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$AuthToken")) | |
# 'Authorization' = "Bearer <YOUR-TOKEN>" | |
$recentUpdates = scoop list | Sort-Object -Descending Updated | Where-Object { ((Get-Date) - [DateTime]$_.Updated).Days -lt $NumberOfDays } | |
$recentUpdates | ForEach-Object { | |
$app = "$($_.Source)/$($_.Name)" | |
$manifest = scoop cat $app | ConvertFrom-Json | |
$url = $manifest.architecture.'64bit'.url | |
if (!$url) { $url = $manifest.url } | |
if ($url -match 'https://github.com/(?<owner>.+)/(?<repo>.+)/releases/download/(?<release>.+)/') { | |
$owner = $matches['owner'] | |
$repo = $matches['repo'] | |
$release = $matches['release'] | |
$notesUri = 'https://api.github.com/repos/{0}/{1}/releases' -f $owner, $repo | |
$releases = (Invoke-WebRequest -Headers @{ | |
'Accept' = 'application/vnd.github+json' | |
'X-GitHub-Api-Version' = '2022-11-28' | |
} -Uri $notesUri).Content | ConvertFrom-Json | |
$body = ($releases | Where-Object tag_name -eq $release).body | |
if ($body.Length -ne 0) { | |
Write-Host -ForegroundColor Yellow ('-' * 79) | |
Write-Host "Release notes for $owner/$repo ($release)" | |
Write-Host $notesUri | |
Write-Host -ForegroundColor Yellow ('-' * 79) | |
Write-Host $body | |
Write-Host '' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment