Skip to content

Commit

Permalink
Merge pull request #858 from pkvach/handle-missing-openai-key
Browse files Browse the repository at this point in the history
Handle OPENAI_KEY not set error in github_action_runner.py
  • Loading branch information
mrT23 authored Apr 12, 2024
2 parents af8ca7d + 4c83bf6 commit 654f88b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pr_agent/servers/github_action_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ async def run_action():
if not GITHUB_EVENT_PATH:
print("GITHUB_EVENT_PATH not set")
return
if not OPENAI_KEY:
print("OPENAI_KEY not set")
return
if not GITHUB_TOKEN:
print("GITHUB_TOKEN not set")
return

# Set the environment variables in the settings
get_settings().set("OPENAI.KEY", OPENAI_KEY)
if OPENAI_KEY:
get_settings().set("OPENAI.KEY", OPENAI_KEY)
else:
# Might not be set if the user is using models not from OpenAI
print("OPENAI_KEY not set")
if OPENAI_ORG:
get_settings().set("OPENAI.ORG", OPENAI_ORG)
get_settings().set("GITHUB.USER_TOKEN", GITHUB_TOKEN)
Expand Down

0 comments on commit 654f88b

Please sign in to comment.