Add commits-since function

This commit is contained in:
2024-10-06 19:31:14 +02:00
parent 774cec521e
commit 670c6c738e
3 changed files with 203 additions and 1 deletions

View File

@@ -23,6 +23,14 @@ def commit_in_branch(commit_sha: str, branch: str) -> bool:
return False
def commits_since(first_ref: str, last_ref: str) -> int:
url = f"https://api.github.com/repos/NixOS/nixpkgs/compare/{first_ref}...{last_ref}"
commit_response = requests.get(url, headers=DEFAULT_HEADERS)
commit_response.raise_for_status()
return commit_response.json()["behind_by"]
def pr_merge_status(pr: int, branches: list[str] = DEFAULT_BRANCHES) -> PRStatus:
url = f"https://api.github.com/repos/NixOS/nixpkgs/pulls/{pr}"
pr_response = requests.get(url, headers=DEFAULT_HEADERS)