diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml index 03661b0dfb2..8a76150e796 100644 --- a/.github/workflows/autoupdate.yml +++ b/.github/workflows/autoupdate.yml @@ -40,6 +40,6 @@ jobs: - name: Auto-update packages run: | - xmake l -vD scripts/autoupdate.lua 1 + xmake l -vD scripts/autoupdate.lua 3 diff --git a/scripts/autoupdate.lua b/scripts/autoupdate.lua index 4519d889f75..5af9771a472 100644 --- a/scripts/autoupdate.lua +++ b/scripts/autoupdate.lua @@ -94,12 +94,14 @@ function main(maxcount) local count = 0 local maxcount = tonumber(maxcount or 10) local instances = _get_all_packages() - for _, instance in ipairs(instances) do + math.randomseed(os.time()) + while count < maxcount do + local instance = instances[math.random(#instances)] local checkupdate_filepath = path.join(instance:scriptdir(), "checkupdate.lua") if not os.isfile(checkupdate_filepath) then checkupdate_filepath = path.join(os.scriptdir(), "checkupdate.lua") end - if os.isfile(checkupdate_filepath) and count < maxcount then + if os.isfile(checkupdate_filepath) then local checkupdate = import("checkupdate", {rootdir = path.directory(checkupdate_filepath), anonymous = true}) local version, shasum = checkupdate(instance) if version and shasum and not _is_pending(instance, version) then