mirror of
https://github.com/Jguer/yay.git
synced 2026-07-20 15:07:33 -04:00
* add upgrade hook structure * remove extra field * feat: Add UpgradeSelect hook logging and security example Add yay.log API to UpgradeSelect hooks for informational and warning messages. - Add yay.log.info() and yay.log.warn() for hook logging - Add doc/examples/recently_modified.lua: practical example to pre-exclude recently-modified AUR packages (supply chain attack mitigation) - Update doc/init.lua with improved UpgradeSelect example - Update doc/lua.md with logging API documentation - Refactor autocmd and load modules for cleaner log integration - Add comprehensive unit tests for logging functionality * lint
16 lines
596 B
Lua
16 lines
596 B
Lua
yay.create_autocmd("UpgradeSelect", {
|
|
desc = "skip recently modified AUR upgrades",
|
|
callback = function(event)
|
|
yay.log.info("pre-excluding AUR packages modified in the last 3 days")
|
|
local exclude = {}
|
|
local recent_cutoff = os.time() - (3 * 24 * 60 * 60)
|
|
for _, pkg in ipairs(event.data.upgrades) do
|
|
if pkg.repository == "aur" and pkg.last_modified >= recent_cutoff then
|
|
yay.log.warn("pre-excluding recently modified AUR package: ", pkg.name)
|
|
table.insert(exclude, pkg.name)
|
|
end
|
|
end
|
|
|
|
return { exclude = exclude, skip_menu = false }
|
|
end,
|
|
}) |