From a626d865c0b27d583b92ce359ad484d86aabdce1 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 17 Jun 2025 16:11:12 +0100 Subject: [PATCH] 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 --- scripts/ci/do_not_merge.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/ci/do_not_merge.py b/scripts/ci/do_not_merge.py index 6529835b0f0..ccaa806bfeb 100755 --- a/scripts/ci/do_not_merge.py +++ b/scripts/ci/do_not_merge.py @@ -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)