Update language files

This commit is contained in:
2025-08-30 10:18:04 +00:00
parent a32dc68e92
commit 3df2538080
4 changed files with 104 additions and 2 deletions

View File

@@ -58,13 +58,44 @@ def setup_git_repo():
return True
def verify_git_remote():
result = subprocess.run("git remote -v", shell=True, capture_output=True, text=True, cwd="/app")
if result.returncode != 0:
print("Error checking Git remote configuration")
return False
remote_output = result.stdout.strip()
if not remote_output:
print("No Git remote configured")
return False
print(f"Git remote configuration: {remote_output}")
return True
def commit_and_push_changes():
if not os.path.exists("/app/.git"):
return False
if not verify_git_remote():
print("Git remote not properly configured")
return False
try:
run_git_command("git add .")
run_git_command("git commit -m 'Update language files'")
github_token = os.environ.get('GITHUB_TOKEN')
if github_token:
git_repo_url = os.environ.get('GIT_REPO_URL')
git_username = os.environ.get('GIT_USERNAME')
if git_repo_url.startswith('https://'):
auth_url = git_repo_url.replace('https://', f'https://{git_username}:{github_token}@')
print(f"Setting authenticated remote URL: {auth_url}")
run_git_command(f"git remote set-url origin {auth_url}")
print("Updated Git remote configuration:")
run_git_command("git remote -v")
run_git_command("git push origin HEAD")
print("Changes committed and pushed to Git repository")
return True