mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 19:43:15 +00:00
* feat: add GitHub PR comment trigger and reply support * refactor: improve readability of GitHub integration * linting * fix: resolve github token from thread metadata and improve PR trigger flow * fix: fall back to OAuth for GitHub webhook when no token in thread metadata * give me commit message github integeration working without a breaking * auth.py refactor * fix: validate cached GitHub token before use to handle expiry * liniting * ci unitest formatting * feat: post PR comments as GitHub App bot instead of user OAuth token * resolved comments * slack resolveed comments * Refactor docstring and comments in get_slack_repo_config Removed unnecessary comments and cleaned up docstring formatting. * cr * cr * cr * cr --------- Co-authored-by: bracesproul <braceasproul@gmail.com>
28 lines
1 KiB
Python
28 lines
1 KiB
Python
import asyncio
|
|
from typing import Any
|
|
|
|
from langgraph.config import get_config
|
|
|
|
from ..utils.github_app import get_github_app_installation_token
|
|
from ..utils.github_comments import post_github_comment
|
|
|
|
|
|
def github_comment(message: str, issue_number: int) -> dict[str, Any]:
|
|
"""Post a comment to a GitHub issue or pull request."""
|
|
config = get_config()
|
|
configurable = config.get("configurable", {})
|
|
|
|
repo_config = configurable.get("repo", {})
|
|
if not issue_number:
|
|
return {"success": False, "error": "Missing issue_number argument"}
|
|
if not repo_config:
|
|
return {"success": False, "error": "No repo config found in config"}
|
|
if not message.strip():
|
|
return {"success": False, "error": "Message cannot be empty"}
|
|
|
|
token = asyncio.run(get_github_app_installation_token())
|
|
if not token:
|
|
return {"success": False, "error": "Failed to get GitHub App installation token"}
|
|
|
|
success = asyncio.run(post_github_comment(repo_config, issue_number, message, token=token))
|
|
return {"success": success}
|