From 71b2a971129727f482d3c22e611d7867ab8487c9 Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Sun, 29 Jun 2025 06:58:38 +0300 Subject: [PATCH] Fix workflow py script --- automation/alerts/generate_monitor_workflow.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/automation/alerts/generate_monitor_workflow.py b/automation/alerts/generate_monitor_workflow.py index efe53da..510f285 100644 --- a/automation/alerts/generate_monitor_workflow.py +++ b/automation/alerts/generate_monitor_workflow.py @@ -104,10 +104,19 @@ def push_workflow(): repo_path = os.path.join(BASE_DIR, "lab-monitor") if not os.path.exists(repo_path): subprocess.run(["git", "clone", GITHUB_REPO, repo_path]) - subprocess.run(["git", "-C", repo_path, "pull"]) + subprocess.run(["git", "-C", repo_path, "pull", "origin", "main"]) + + # Set Git identity + subprocess.run(["git", "-C", repo_path, "config", "user.name", "lab-monitor-bot"]) + subprocess.run(["git", "-C", repo_path, "config", "user.email", "bot@dvirlabs.com"]) + + # Add + Commit subprocess.run(["git", "-C", repo_path, "add", ".github/workflows/monitor.yml"]) - subprocess.run(["git", "-C", repo_path, "commit", "-m", "update monitor.yml from monitoring.yaml"]) - subprocess.run(["git", "-C", repo_path, "push"]) + subprocess.run(["git", "-C", repo_path, "commit", "-m", "update monitor.yml from monitoring.yaml"], check=False) + + # Push with upstream set to main + subprocess.run(["git", "-C", repo_path, "push", "--set-upstream", "origin", "main"]) + if __name__ == "__main__": clone_repos()