Skip to content

Commit 7df46f4

Browse files
committed
testing new wrapper
1 parent 56f1712 commit 7df46f4

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

devolv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "0.2.9"
1+
__version__ = "0.2.10"
22

devolv/drift/github_approvals.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import subprocess
23
from github import Github
34

45
def _get_github_token():
@@ -48,14 +49,21 @@ def create_github_pr(repo: str, head_branch: str, title: str, body: str, base: s
4849

4950
def push_branch(branch_name: str):
5051
"""
51-
Create, commit, and push a branch with local changes to GitHub.
52+
Create and push a branch with committed changes.
5253
"""
5354
try:
54-
os.system(f"git checkout -b {branch_name}")
55-
os.system("git add .")
56-
os.system("git commit -m 'Update policy via Devolv drift'")
57-
os.system(f"git push origin {branch_name}")
58-
print(f"✅ Pushed branch {branch_name} to origin")
59-
except Exception as e:
60-
print(f"❌ Failed to push branch {branch_name}: {e}")
61-
raise
55+
subprocess.run(["git", "checkout", "-b", branch_name], check=True)
56+
57+
# Configure git user identity locally
58+
subprocess.run(["git", "config", "user.email", "github-actions@users.noreply.github.com"], check=True)
59+
subprocess.run(["git", "config", "user.name", "github-actions"], check=True)
60+
61+
subprocess.run(["git", "add", "."], check=True)
62+
subprocess.run(["git", "commit", "-m", f"Update policy from AWS: {branch_name}"], check=True)
63+
subprocess.run(["git", "push", "--set-upstream", "origin", branch_name], check=True)
64+
65+
typer.echo(f"✅ Pushed branch {branch_name} to origin.")
66+
except subprocess.CalledProcessError as e:
67+
typer.echo(f"❌ Git command failed: {e}")
68+
raise typer.Exit(1)
69+

0 commit comments

Comments
 (0)