Skip to content

Commit

Permalink
made changes to github helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarraann committed Aug 24, 2023
1 parent 83463b3 commit 2fb1fe1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions superagi/helper/github_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ def add_file(self, repository_owner, repository_name, file_name, folder_path, he
Returns:
None
"""
body = self._get_file_content(file_name, agent_id, agent_execution_id, session)
body = self._get_file_contents(file_name, agent_id, agent_execution_id, session)

Check warning on line 221 in superagi/helper/github_helper.py

View check run for this annotation

Codecov / codecov/patch

superagi/helper/github_helper.py#L221

Added line #L221 was not covered by tests
body_bytes = body.encode("ascii")
base64_bytes = base64.b64encode(body_bytes)
file_content = base64_bytes.decode("ascii")
file_path = self.get_file_path(file_name, folder_path)
file_url = f'https://api.github.com/repos/{self.github_username}/{repository_name}/contents/{file_path}'
file_url = f'https://api.github.com/repos/{repository_owner}/{repository_name}/contents/{file_path}'

Check warning on line 226 in superagi/helper/github_helper.py

View check run for this annotation

Codecov / codecov/patch

superagi/helper/github_helper.py#L226

Added line #L226 was not covered by tests
file_params = {
'message': commit_message,
'content': file_content,
Expand Down Expand Up @@ -328,6 +328,7 @@ def _get_file_contents(self, file_name, agent_id, agent_execution_id, session):
agent=Agent.get_agent_from_id(session, agent_id),
agent_execution=AgentExecution.get_agent_execution_from_id(
session, agent_execution_id))

if StorageType.get_storage_type(get_config("STORAGE_TYPE", StorageType.FILE.value)) == StorageType.S3:
attachment_data = S3Helper().read_from_s3(final_path)
else:
Expand Down

0 comments on commit 2fb1fe1

Please sign in to comment.