From 766b3f8db2ea6359c266fb78fa23b6431786dcf2 Mon Sep 17 00:00:00 2001 From: Bernhard Kaindl Date: Tue, 18 Jun 2024 12:00:00 +0200 Subject: [PATCH] pre-commit check for need of rebase: Enable output logging Signed-off-by: Bernhard Kaindl --- .github/workflows/check_branch-needs-rebase.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_branch-needs-rebase.py b/.github/workflows/check_branch-needs-rebase.py index 305641e..a8e66f9 100755 --- a/.github/workflows/check_branch-needs-rebase.py +++ b/.github/workflows/check_branch-needs-rebase.py @@ -4,11 +4,12 @@ # pylint: disable=using-f-string-in-unsupported-version import subprocess import sys -from logging import info as log +from logging import basicConfig, INFO, info as log def run(command: list[str], check=False) -> tuple[int, str]: """Run a command and return the output.""" + log(" ".join(command)) cmd: subprocess.CompletedProcess[str] = subprocess.run( command, check=check, @@ -30,8 +31,7 @@ def check_if_local_branch_is_behind_target( # Fetch the remote branch in order to get the number of commits behind if run(["git", "fetch", *target.split("/", maxsplit=1)])[0]: - log("Failed to fetch the remote branch") - return 1 + log("Failed to fetch the remote branch, but you may be offline, go online.") # Get the number of commits behind the remote branch error, commits_behind = run( @@ -99,4 +99,5 @@ def main(): if __name__ == "__main__": + basicConfig(format="%(message)s", level=INFO) sys.exit(main())