Skip to content

Commit a626d86

Browse files
fabiobaltierinashif
authored andcommitted
scripts: do_not_merge: print the API limit stats
This information is useful for troubleshooting and not available anywhere else, does not quite belong to this script but this runs for every PR so it's not a bad place to have it. Signed-off-by: Fabio Baltieri <[email protected]>
1 parent ac711c9 commit a626d86

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/ci/do_not_merge.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
DNM_LABELS = ["DNM", "DNM (manifest)", "TSC", "Architecture Review", "dev-review"]
1313

1414

15+
def print_rate_limit(gh, org):
16+
response = gh.get_organization(org)
17+
for header, value in response.raw_headers.items():
18+
if header.startswith("x-ratelimit"):
19+
print(f"{header}: {value}")
20+
21+
1522
def parse_args(argv):
1623
parser = argparse.ArgumentParser(
1724
description=__doc__,
@@ -29,6 +36,9 @@ def main(argv):
2936

3037
token = os.environ.get('GITHUB_TOKEN', None)
3138
gh = github.Github(token)
39+
40+
print_rate_limit(gh, "zephyrproject-rtos")
41+
3242
repo = gh.get_repo("zephyrproject-rtos/zephyr")
3343
pr = repo.get_pull(args.pull_request)
3444

0 commit comments

Comments
 (0)