Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/bot_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ def get_local_repo_path(repo_name: str) -> str:
Returns:
- Path to the local repository
"""
repo_name_split = repo_name.split('/')
repo_path = os.path.join(
src_dir, 'repos', repo_name_split[0], repo_name_split[1])
local_path = os.path.join(base_dir, 'repos')

# Construct full path for clone
repo_path = os.path.join(local_path, repo_name)
if os.path.exists(repo_path):
return repo_path
else:
Expand Down
18 changes: 11 additions & 7 deletions src/git_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""
Utility functions for interacting with GitHub API
"""
import string
import re
from dotenv import load_dotenv
from github.PullRequest import PullRequest
from typing import List, Dict, Optional, Tuple, Union
import os
import subprocess
Expand All @@ -15,11 +19,12 @@
from github import Github
from github.Issue import Issue
from github.Repository import Repository
import os
from github.IssueComment import IssueComment
from github.PullRequest import PullRequest
from dotenv import load_dotenv
import re
import string

# Determine base directory
src_dir = os.path.dirname(os.path.abspath(__file__))
base_dir = os.path.dirname(src_dir)


def clean_response(response: str) -> str:
Expand Down Expand Up @@ -203,14 +208,13 @@
import git

full_repo_name = repo.full_name
repo_split = full_repo_name.split('/')
local_path = os.path.join('repos', repo_split[0])
local_path = os.path.join(base_dir, 'repos')

Check warning on line 211 in src/git_utils.py

View check run for this annotation

Codecov / codecov/patch

src/git_utils.py#L211

Added line #L211 was not covered by tests

# Create directory if it doesn't exist
os.makedirs(local_path, exist_ok=True)

# Construct full path for clone
repo_dir = os.path.join(local_path, repo.name)
repo_dir = os.path.join(local_path, full_repo_name)

Check warning on line 217 in src/git_utils.py

View check run for this annotation

Codecov / codecov/patch

src/git_utils.py#L217

Added line #L217 was not covered by tests

# Clone if doesn't exist, or return existing path
if not os.path.exists(repo_dir):
Expand Down