82fcd5a4bc
Closes #7
38 lines
1.4 KiB
Python
Executable File
38 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import sys
|
|
|
|
# Auto-execute using the project's local virtual environment Python
|
|
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
|
|
venv_python = os.path.join(PROJECT_ROOT, "venv", "bin", "python3")
|
|
if os.path.exists(venv_python) and sys.executable != venv_python:
|
|
os.execv(venv_python, [venv_python] + sys.argv)
|
|
|
|
from gitea_auth import get_auth_header, api_request, REMOTES, repo_api_url
|
|
|
|
def main():
|
|
for name, remote in REMOTES.items():
|
|
host = remote['host']
|
|
org = remote['org']
|
|
repo = remote['repo']
|
|
print(f"Checking remote: {name} ({host}/{org}/{repo})...")
|
|
try:
|
|
auth = get_auth_header(host)
|
|
if not auth:
|
|
print(f" No auth header found for {host}")
|
|
continue
|
|
url = f"{repo_api_url(host, org, repo)}/pulls?state=open"
|
|
prs = api_request("GET", url, auth)
|
|
if not prs:
|
|
print(" No open pull requests.")
|
|
for pr in prs:
|
|
print(f" PR #{pr['number']}: {pr['title']}")
|
|
print(f" Branch: {pr['head']['ref']} -> {pr['base']['ref']}")
|
|
print(f" URL: {pr['html_url']}")
|
|
print(f" Mergeable: {pr.get('mergeable')}")
|
|
except Exception as e:
|
|
print(f" Error: {e}")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|