Add gitea-shim integration and update workflow services
This commit is contained in:
@ -1,8 +1,20 @@
|
||||
import re
|
||||
import requests
|
||||
from github import Github
|
||||
import os
|
||||
import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add the gitea-shim to the path
|
||||
gitea_shim_path = Path(__file__).parent.parent.parent.parent.parent / "gitea-shim" / "python"
|
||||
sys.path.insert(0, str(gitea_shim_path))
|
||||
|
||||
try:
|
||||
from gitea_shim import get_github_client, is_gitea_mode
|
||||
except ImportError:
|
||||
# Fallback to regular GitHub if shim is not available
|
||||
from github import Github as get_github_client
|
||||
is_gitea_mode = lambda: False
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -14,7 +26,11 @@ def verify_pr_ownership(
|
||||
expected_repo,
|
||||
):
|
||||
try:
|
||||
gh = Github(os.environ.get("GITHUB_TOKEN"))
|
||||
# Use the shim to get GitHub-compatible client
|
||||
gh = get_github_client()
|
||||
|
||||
# Log which API we're using
|
||||
logger.info(f"Using {'Gitea' if is_gitea_mode() else 'GitHub'} API for PR verification")
|
||||
|
||||
match = re.match(r"https://github.com/([^/]+)/([^/]+)/pull/(\d+)", pr_url)
|
||||
if not match:
|
||||
|
Reference in New Issue
Block a user