Skip to main content
Glama
execute_git_push.py2.72 kB
#!/usr/bin/env python3 import subprocess import os import sys def run_command(cmd, timeout=30): """Execute command with timeout and capture output""" try: print(f"Executing: {' '.join(cmd)}") result = subprocess.run( cmd, capture_output=True, text=True, timeout=timeout, cwd='/workspace' ) print(f"Return code: {result.returncode}") if result.stdout: print(f"STDOUT:\n{result.stdout}") if result.stderr: print(f"STDERR:\n{result.stderr}") return result.returncode == 0, result.stdout, result.stderr except subprocess.TimeoutExpired: print(f"Command timed out: {' '.join(cmd)}") return False, "", "Timeout" except Exception as e: print(f"Exception: {e}") return False, "", str(e) def main(): os.chdir('/workspace') print("=== TASK: Kill Railway & Push Git ===") # 1. Kill Railway processes print("\n1. Killing Railway server processes...") success, stdout, stderr = run_command(['pkill', '-f', 'start_railway.py'], timeout=10) if "Process found" in stderr or "no process found" in stderr: print("Railway processes handled") else: print("Railway process kill attempted") # 2. Git operations print("\n2. Git operations...") # Check git status print("\n2.1 Checking git status...") success, stdout, stderr = run_command(['git', 'status', '--porcelain']) print(f"Git status output: '{stdout}'") if stdout.strip(): print("\n2.2 Staging changes...") success, stdout, stderr = run_command(['git', 'add', '.']) print(f"Git add result: {success}") print("\n2.3 Committing changes...") commit_msg = 'Add manual JWT token generation endpoint and fix auth middleware for public routes' success, stdout, stderr = run_command(['git', 'commit', '-m', commit_msg]) print(f"Git commit result: {success}") print(f"Commit output: {stdout}") else: print("\n2.2 No changes to commit") # 3. Push to GitHub print("\n3. Pushing to GitHub...") success, stdout, stderr = run_command(['git', 'push', 'origin', 'main']) print(f"Git push result: {success}") if success: print("\n✅ TASK COMPLETED SUCCESSFULLY!") print("✅ Railway processes killed") print("✅ Changes committed to git") print("✅ Pushed to GitHub repository") else: print("\n❌ TASK COMPLETED WITH WARNINGS") print(f"Push output: {stdout}") print(f"Push error: {stderr}") if __name__ == "__main__": main()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Pritrj/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server