Github action to work with an image stored on Dockerhub for faster execution

This commit is contained in:
Ori Kotek
2023-07-16 14:19:02 +03:00
parent 2531849b73
commit 7958786b4c
4 changed files with 9 additions and 5 deletions

View File

View File

@ -0,0 +1 @@
FROM codiumai/pr-agent:github_action

View File

@ -2,4 +2,4 @@ name: 'PR Agent'
description: 'Summarize, review and suggest improvements for pull requests' description: 'Summarize, review and suggest improvements for pull requests'
runs: runs:
using: 'docker' using: 'docker'
image: 'Dockerfile.github_action' image: 'Dockerfile.github_action_dockerhub'

View File

@ -19,10 +19,11 @@ async def run_action():
if not GITHUB_EVENT_PATH: if not GITHUB_EVENT_PATH:
print("GITHUB_EVENT_PATH not set") print("GITHUB_EVENT_PATH not set")
return return
event_payload = json.load(open(GITHUB_EVENT_PATH, 'r')) try:
RUNNER_DEBUG = os.environ.get('RUNNER_DEBUG', None) event_payload = json.load(open(GITHUB_EVENT_PATH, 'r'))
if not RUNNER_DEBUG: except json.decoder.JSONDecodeError as e:
print("RUNNER_DEBUG not set") print(f"Failed to parse JSON: {e}")
return
OPENAI_KEY = os.environ.get('OPENAI_KEY', None) OPENAI_KEY = os.environ.get('OPENAI_KEY', None)
if not OPENAI_KEY: if not OPENAI_KEY:
print("OPENAI_KEY not set") print("OPENAI_KEY not set")
@ -64,6 +65,8 @@ async def run_action():
if matches: if matches:
question = matches[0][1] question = matches[0][1]
await PRQuestions(pr_url, question).answer() await PRQuestions(pr_url, question).answer()
else:
print(f"Unknown command: {body}")
if __name__ == '__main__': if __name__ == '__main__':