newModuleTagger: query for smaller pages
This commit is contained in:
@@ -7,7 +7,8 @@ import subprocess
|
||||
import json
|
||||
|
||||
|
||||
PAGINATION_STEP=20
|
||||
PAGINATION_STEP=3
|
||||
PAGES=400
|
||||
|
||||
|
||||
GRAPHQL_QUERY = """
|
||||
@@ -31,7 +32,7 @@ query($endCursor: String) {
|
||||
author {
|
||||
login
|
||||
}
|
||||
files(first: 50) {
|
||||
files(first: 20) {
|
||||
edges {
|
||||
node {
|
||||
path
|
||||
@@ -39,7 +40,7 @@ query($endCursor: String) {
|
||||
}
|
||||
}
|
||||
}
|
||||
labels(first: 50) {
|
||||
labels(first: 20) {
|
||||
edges {
|
||||
node {
|
||||
name
|
||||
@@ -61,14 +62,17 @@ query($endCursor: String) {
|
||||
def _gh(args: list[str]) -> str | None:
|
||||
try:
|
||||
return subprocess.check_output(["gh", *args], text=True)
|
||||
except subprocess.CalledProcessError:
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(e)
|
||||
return None
|
||||
|
||||
|
||||
def find_prs_without_new_module_tag():
|
||||
hasNextPage = True
|
||||
endCursor = None
|
||||
for _ in tqdm(range(100)):
|
||||
|
||||
pbar = tqdm(total=PAGES*PAGINATION_STEP)
|
||||
for i in range(PAGES):
|
||||
prs = _gh(["api", "graphql", '-F', f'endCursor={'null' if endCursor is None else endCursor}', "-f", f"query={GRAPHQL_QUERY}"])
|
||||
if prs is None:
|
||||
print("gh exited with error")
|
||||
@@ -93,6 +97,8 @@ def find_prs_without_new_module_tag():
|
||||
for pr in reversed(prs):
|
||||
print_pr(pr)
|
||||
|
||||
pbar.update(PAGINATION_STEP)
|
||||
|
||||
|
||||
def print_pr(pr):
|
||||
tqdm.write(f'[{pr["state"]}|{pr["number"]}] {pr["author"]} - {pr["title"]}')
|
||||
|
||||
Reference in New Issue
Block a user