mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-03 20:03:25 +01:00
Process oldest issues first; raise page cap
Add sort: 'updated' and order: 'asc' to the issues search so closed/unlocked items are processed oldest-first. Improve logging to show items per page and total_count. Increase the pagination limit from 10 to 100 (allowing up to ~10,000 results) and update related comments.
This commit is contained in:
10
.github/workflows/lock-issue.yaml
generated
vendored
10
.github/workflows/lock-issue.yaml
generated
vendored
@@ -28,20 +28,22 @@ jobs:
|
|||||||
/dependabot/i
|
/dependabot/i
|
||||||
];
|
];
|
||||||
|
|
||||||
// Search for closed, unlocked issues older than 3 days (paginated)
|
// Search for closed, unlocked issues older than 3 days (paginated, oldest first)
|
||||||
let page = 1;
|
let page = 1;
|
||||||
let totalLocked = 0;
|
let totalLocked = 0;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const issues = await github.rest.search.issuesAndPullRequests({
|
const issues = await github.rest.search.issuesAndPullRequests({
|
||||||
q: `repo:${context.repo.owner}/${context.repo.repo} is:closed is:unlocked updated:<${lockDate.toISOString().split('T')[0]}`,
|
q: `repo:${context.repo.owner}/${context.repo.repo} is:closed is:unlocked updated:<${lockDate.toISOString().split('T')[0]}`,
|
||||||
|
sort: 'updated',
|
||||||
|
order: 'asc',
|
||||||
per_page: 100,
|
per_page: 100,
|
||||||
page: page
|
page: page
|
||||||
});
|
});
|
||||||
|
|
||||||
if (issues.data.items.length === 0) break;
|
if (issues.data.items.length === 0) break;
|
||||||
|
|
||||||
console.log(`Processing page ${page} with ${issues.data.items.length} issues/PRs`);
|
console.log(`Page ${page}: ${issues.data.items.length} items (total available: ${issues.data.total_count})`);
|
||||||
|
|
||||||
for (const item of issues.data.items) {
|
for (const item of issues.data.items) {
|
||||||
// Skip excluded items
|
// Skip excluded items
|
||||||
@@ -68,8 +70,8 @@ jobs:
|
|||||||
|
|
||||||
page++;
|
page++;
|
||||||
|
|
||||||
// GitHub search API limit: max 1000 results
|
// GitHub search API limit: max 10000 results (100 pages * 100) - temporarily increased
|
||||||
if (page > 10) break;
|
if (page > 100) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Total locked: ${totalLocked} issues/PRs`);
|
console.log(`Total locked: ${totalLocked} issues/PRs`);
|
||||||
|
|||||||
Reference in New Issue
Block a user