82fcd5a4bc
Closes #7
37 lines
1.2 KiB
Python
Executable File
37 lines
1.2 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
|
|
|
|
def main():
|
|
host = 'gitea.prgs.cc'
|
|
org = 'Scaled-Tech-Consulting'
|
|
repo = 'Gitea-Tools'
|
|
print(f"Checking repo: {host}/{org}/{repo}...")
|
|
try:
|
|
auth = get_auth_header(host)
|
|
if not auth:
|
|
print(f" No auth header found for {host}")
|
|
return
|
|
url = f"https://{host}/api/v1/repos/{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()
|