Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from gynzy/SRE-318
Browse files Browse the repository at this point in the history
feat: run analysis also on ready_for_review, synchronize events
  • Loading branch information
genisd authored Sep 11, 2023
2 parents 0f7a481 + 712f0ff commit f76d18b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ branding:
color: 'green'
runs:
using: 'docker'
image: 'Dockerfile.github_action_dockerhub'
image: 'Dockerfile.github_action'
8 changes: 6 additions & 2 deletions pr_agent/servers/github_action_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,21 @@ async def run_action():
print(f"Failed to parse JSON: {e}")
return

print('handling ' + GITHUB_EVENT_NAME + ' event')
# Handle pull request event
if GITHUB_EVENT_NAME == "pull_request":
action = event_payload.get("action")
if action in ["opened", "reopened"]:
print('handling ' + action + ' action')
if action in ["opened", "reopened", "synchronize", "ready_for_review"]:
pr_url = event_payload.get("pull_request", {}).get("url")
if pr_url:
print('doing review of pr url:' + pr_url)
await PRReviewer(pr_url).run()

# Handle issue comment event
elif GITHUB_EVENT_NAME == "issue_comment":
action = event_payload.get("action")
print('handling ' + action + ' action')
if action in ["created", "edited"]:
comment_body = event_payload.get("comment", {}).get("body")
if comment_body:
Expand All @@ -70,4 +74,4 @@ async def run_action():


if __name__ == '__main__':
asyncio.run(run_action())
asyncio.run(run_action())

0 comments on commit f76d18b

Please sign in to comment.