Skip to content

Commit

Permalink
Fancy
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Feb 14, 2025
1 parent ed38a86 commit 159cdcb
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions utils/update-manifest.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import Pkg

const IS_INSTALLED = r"\s*Installed (.+)"
const DETAILS_BEGIN = """
<details>
<summary>
All package versions
</summary>
"""

"""
Update the Julia Manifest.toml and show the changes as well as outdated packages.
The output is written to a file that can be used as the body of a pull request.
Expand All @@ -8,10 +17,30 @@ function (@main)(_)
path = normpath(@__DIR__, "../.pixi/update-manifest-julia.md")
redirect_stdio(; stdout = path, stderr = path) do
println("Update the Julia Manifest.toml to get the latest dependencies.\n")
println("Output of `Pkg.update()`\n```")
println("__Changed packages__`\n```")
Pkg.update()
println("```\n\nOutput of `Pkg.status(; outdated=true)`\n```")
println("```\n\n__Packages still outdated after update__`\n```")
Pkg.status(; outdated = true)
println("```")
end

# The Pkg.update output first prints all installed package versions.
# This is a lot, strip it out, sort it, and put it in a details tag at the end.
installed_lines = String[]
lines = readlines(path)
open(path, "w") do io
for line in lines
m = match(IS_INSTALLED, line)
if m === nothing
println(io, line)
else
push!(installed_lines, only(m.captures))
end
end

println(io, DETAILS_BEGIN)
sort!(installed_lines)
foreach(line -> println(io, line), installed_lines)
println("\n\n</details>")
end
end

0 comments on commit 159cdcb

Please sign in to comment.