-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautomate_workflow.py
More file actions
35 lines (27 loc) · 821 Bytes
/
automate_workflow.py
File metadata and controls
35 lines (27 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import subprocess
import sys
import os
def run_command(cmd):
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode != 0:
print(f"Error: {result.stderr}")
sys.exit(1)
return result.stdout
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python automate_workflow.py <prompt>")
sys.exit(1)
prompt = sys.argv[1]
# Run aider with the prompt
print("Running Aider...")
run_command(f'aider "{prompt}"')
# Add changes
print("Adding changes to git...")
run_command("git add .")
# Commit
print("Committing changes...")
run_command('git commit -m "Automated code generation"')
# Push
print("Pushing to GitHub...")
run_command("git push")
print("Workflow completed!")