Pull and rebase before committing
This commit is contained in:
@@ -20,6 +20,13 @@ def write_zone_export(zone_name, content) -> Path:
|
||||
return out_path
|
||||
|
||||
def commit_and_push(changed_files, trigger_path):
|
||||
# Pull from remote, rebasing
|
||||
try:
|
||||
run_git_cmd(["pull", "--rebase", "origin", "master"])
|
||||
except subprocess.CalledProcessError as e:
|
||||
logging.exception(f"git pull --rebase failed: {e}")
|
||||
return
|
||||
|
||||
# Stage files
|
||||
try:
|
||||
# Add only the exports folder (keeps repo tidy)
|
||||
@@ -31,7 +38,7 @@ def commit_and_push(changed_files, trigger_path):
|
||||
# Check if there is anything to commit
|
||||
try:
|
||||
# git diff --cached --quiet will exit 0 if no changes staged
|
||||
subprocess.run(["git", "-C", GIT_REPO_DIR, "diff", "--cached", "--quiet"], check=True)
|
||||
run_git_cmd(["diff", "--cached", "--quiet"], check=True)
|
||||
logging.info("No changes to commit (nothing staged).")
|
||||
return
|
||||
except subprocess.CalledProcessError:
|
||||
|
Reference in New Issue
Block a user