Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update token #3076

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]"
git config --global user.name "ruki"

Expand All @@ -37,6 +37,6 @@ jobs:

- name: Auto-update packages
run: |
xmake l -vD scripts/autoupdate.lua 1
xmake l -vD scripts/autoupdate.lua 3


6 changes: 4 additions & 2 deletions scripts/autoupdate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading