Fix workflow py script

This commit is contained in:
dvirlabs 2025-06-29 06:58:38 +03:00
parent 9b15f3e0f9
commit 71b2a97112

View File

@ -104,10 +104,19 @@ def push_workflow():
repo_path = os.path.join(BASE_DIR, "lab-monitor") repo_path = os.path.join(BASE_DIR, "lab-monitor")
if not os.path.exists(repo_path): if not os.path.exists(repo_path):
subprocess.run(["git", "clone", GITHUB_REPO, 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, "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, "commit", "-m", "update monitor.yml from monitoring.yaml"], check=False)
subprocess.run(["git", "-C", repo_path, "push"])
# Push with upstream set to main
subprocess.run(["git", "-C", repo_path, "push", "--set-upstream", "origin", "main"])
if __name__ == "__main__": if __name__ == "__main__":
clone_repos() clone_repos()