bekkalokk/gitea: fix api pagination for web secret provider

This commit is contained in:
Oystein Kristoffer Tveit 2024-12-10 19:35:10 +01:00
parent 40dd069a52
commit 02792fc20e
Signed by untrusted user: oysteikt
GPG Key ID: 9F2F7D8250F35146

View File

@ -34,7 +34,21 @@ def get_org_repo_list(args: argparse.Namespace, token: str):
f"{args.api_url}/orgs/{args.org}/repos",
headers = { 'Authorization': 'token ' + token },
)
return [repo["name"] for repo in result.json()]
results = [repo["name"] for repo in result.json()]
target = int(result.headers['X-Total-Count'])
i = 2
while len(results) < target:
result = requests.get(
f"{args.api_url}/orgs/{args.org}/repos",
params = { 'page': i },
headers = { 'Authorization': 'token ' + token },
)
results += [repo["name"] for repo in result.json()]
i += 1
return results
def generate_ssh_key(args: argparse.Namespace, repository: str):