Skip to content

Commit

Permalink
Don't complain about lack of api key when the action is run on a fork
Browse files Browse the repository at this point in the history
  • Loading branch information
TechNickAI committed Sep 3, 2023
1 parent a0a0088 commit 0ebac40
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions aicodebot_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import json, os, subprocess, sys


def main(comment=True):
def main(comment_on_commit=True):
"""Run the AICodeBot action"""
cli_runner = setup_cli()
review_status, review_comments = review_code(cli_runner)
Expand All @@ -17,7 +17,7 @@ def main(comment=True):
else:
exit_status = 0

if comment:
if comment_on_commit:
comment_on_commit(review_status, review_comments)
sys.exit(exit_status)

Expand All @@ -38,7 +38,11 @@ def setup_cli():
https://docs.github.com/en/actions/security-guides/encrypted-secrets
"""
)
sys.exit(1)
if os.getenv("GITHUB_BASE_REF"):
print("Since this failure on a forked repository, we'll let the action pass without code review.")
sys.exit(0)
else:
sys.exit(1)

# Set the OPENAI_API_KEY environment variable
os.environ["OPENAI_API_KEY"] = openai_api_key
Expand Down

0 comments on commit 0ebac40

Please sign in to comment.