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 <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2025-06-17 16:11:12 +01:00 committed by Anas Nashif
commit a626d865c0

View file

@ -12,6 +12,13 @@ import github
DNM_LABELS = ["DNM", "DNM (manifest)", "TSC", "Architecture Review", "dev-review"]
def print_rate_limit(gh, org):
response = gh.get_organization(org)
for header, value in response.raw_headers.items():
if header.startswith("x-ratelimit"):
print(f"{header}: {value}")
def parse_args(argv):
parser = argparse.ArgumentParser(
description=__doc__,
@ -29,6 +36,9 @@ def main(argv):
token = os.environ.get('GITHUB_TOKEN', None)
gh = github.Github(token)
print_rate_limit(gh, "zephyrproject-rtos")
repo = gh.get_repo("zephyrproject-rtos/zephyr")
pr = repo.get_pull(args.pull_request)