mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 04:40:38 +08:00
Support issue comments in GitHub Actions
This commit is contained in:
@ -5,4 +5,4 @@ branding:
|
|||||||
color: 'green'
|
color: 'green'
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile.github_action_dockerhub'
|
image: 'Dockerfile.github_action'
|
||||||
|
@ -61,12 +61,21 @@ async def run_action():
|
|||||||
if action in ["created", "edited"]:
|
if action in ["created", "edited"]:
|
||||||
comment_body = event_payload.get("comment", {}).get("body")
|
comment_body = event_payload.get("comment", {}).get("body")
|
||||||
if comment_body:
|
if comment_body:
|
||||||
pr_url = event_payload.get("issue", {}).get("pull_request", {}).get("url")
|
is_pr = False
|
||||||
if pr_url:
|
# check if issue is pull request
|
||||||
|
if event_payload.get("issue", {}).get("pull_request"):
|
||||||
|
url = event_payload.get("issue", {}).get("pull_request", {}).get("url")
|
||||||
|
is_pr = True
|
||||||
|
else:
|
||||||
|
url = event_payload.get("issue", {}).get("url")
|
||||||
|
if url:
|
||||||
body = comment_body.strip().lower()
|
body = comment_body.strip().lower()
|
||||||
comment_id = event_payload.get("comment", {}).get("id")
|
comment_id = event_payload.get("comment", {}).get("id")
|
||||||
provider = get_git_provider()(pr_url=pr_url)
|
provider = get_git_provider()(pr_url=url)
|
||||||
await PRAgent().handle_request(pr_url, body, notify=lambda: provider.add_eyes_reaction(comment_id))
|
if is_pr:
|
||||||
|
await PRAgent().handle_request(url, body, notify=lambda: provider.add_eyes_reaction(comment_id))
|
||||||
|
else:
|
||||||
|
await PRAgent().handle_request(url, body)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user