Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure username #74

Merged
merged 1 commit into from
Sep 27, 2024
Merged
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
20 changes: 20 additions & 0 deletions github_resolver/send_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]" && '
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
)
Expand Down Expand Up @@ -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.")
Expand Down