Skip to content

Commit

Permalink
Improve an error handling to debug this: Command 'git init' returned …
Browse files Browse the repository at this point in the history
…non-zero exit status 127.
  • Loading branch information
hiroshinishio committed Jul 8, 2024
1 parent f80047e commit 46024b5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions utils/file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ def run_command(command: str, cwd: str) -> str:
)
return result.stdout
except subprocess.CalledProcessError as e:
# 127: Command not found so check if Git is installed
if e.returncode == 127:
try:
# Check if Git is installed
version_result = subprocess.run(
args="git --version",
capture_output=True,
check=True,
text=True,
shell=True,
)
logging.info("Git version: %s", version_result.stdout)
except subprocess.CalledProcessError as ve:
logging.error("Failed to get Git version: %s", ve.stderr)

raise ValueError(f"Command failed: {e.stderr}") from e


Expand Down
3 changes: 3 additions & 0 deletions utils/text_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def pull_request_completed(
if "[bot]" in issuer_name and ("[bot]" in sender_name or PRODUCT_ID in sender_name):
user_part = ""

elif "[bot]" in issuer_name and ("[bot]" not in sender_name and PRODUCT_ID not in sender_name):
user_part = f"@{sender_name} "

# Ex1) A user is the issuer and sender
# Ex2) sender_name contains gitauto
elif issuer_name == sender_name or PRODUCT_ID in sender_name:
Expand Down

0 comments on commit 46024b5

Please sign in to comment.