Skip to content

Commit

Permalink
community[patch]: helpful error message for GitHubAPIWrapper (#14803)
Browse files Browse the repository at this point in the history
Very simple change in relation to the issue
#14550

@baskaryan, @eyurtsev, @hwchase17.

---------

Co-authored-by: Harrison Chase <[email protected]>
Co-authored-by: Bagatur <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2023
1 parent 922693c commit e3abe12
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libs/community/langchain_community/utilities/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,16 @@ def validate_environment(cls, values: Dict) -> Dict:
private_key,
)
gi = GithubIntegration(auth=auth)
installation = gi.get_installations()[0]

installation = gi.get_installations()
if not installation:
raise ValueError(
f"Please make sure to install the created github app with id "
f"{github_app_id} on the repo: {github_repository}"
"More instructions can be found at "
"https://docs.github.com/en/apps/using-"
"github-apps/installing-your-own-github-app"
)
installation = installation[0]
# create a GitHub instance:
g = installation.get_github_for_installation()
repo = g.get_repo(github_repository)
Expand Down

0 comments on commit e3abe12

Please sign in to comment.