From 484c22ab063f8af78aae0daedfe597656810b882 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 11 Jan 2024 11:44:07 +0800 Subject: [PATCH] update token (#3076) * update token * select package by random --- .github/workflows/autoupdate.yml | 4 ++-- scripts/autoupdate.lua | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml index 4cb7dc1be..22493b4c5 100644 --- a/.github/workflows/autoupdate.yml +++ b/.github/workflows/autoupdate.yml @@ -24,7 +24,7 @@ jobs: echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null sudo apt update sudo apt install -y gh unzip zip - echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token + echo ${{ secrets.XMAKE_REPO_TOKEN }} | gh auth login --with-token git config --global user.email "waruqi@gmail.com" git config --global user.name "ruki" @@ -37,6 +37,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 4519d889f..5af9771a4 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