diff --git a/github_resolver/send_pull_request.py b/github_resolver/send_pull_request.py index 5b9a3ad..5b999f0 100644 --- a/github_resolver/send_pull_request.py +++ b/github_resolver/send_pull_request.py @@ -101,6 +101,25 @@ def initialize_repo( def make_commit(repo_dir: str, issue: GithubIssue) -> None: + + # Check if git username is set + result = subprocess.run( + f"git -C {repo_dir} config user.name", + shell=True, + capture_output=True, + text=True, + ) + if not result.stdout.strip(): + # If username is not set, configure git + subprocess.run( + f'git -C {repo_dir} config user.name "openhands" && ' + f'git -C {repo_dir} config user.email "openhands@all-hands.dev" && ' + f'git -C {repo_dir} config alias.git "git --no-pager"', + shell=True, + check=True, + ) + print("Git user configured as openhands") + result = subprocess.run( f"git -C {repo_dir} add .", shell=True, capture_output=True, text=True ) @@ -316,6 +335,7 @@ def process_all_successful_issues( if my_args.github_username else os.getenv("GITHUB_USERNAME") ) + # Remove the check for github_username if not os.path.exists(my_args.output_dir): raise ValueError(f"Output directory {my_args.output_dir} does not exist.")