From 8ec84207aeca2c0330e604db3e503e1e5878d5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Manuel=20Barroso=20Galindo?= Date: Fri, 8 Mar 2024 01:36:33 +0100 Subject: [PATCH] Debugging changes calculation --- .github/release.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/release.sh b/.github/release.sh index 9f3388f..d618243 100755 --- a/.github/release.sh +++ b/.github/release.sh @@ -10,12 +10,15 @@ subprocess.run(['git', 'commit', '-m', 'BOT: New dont_download.sh'], stdout=subp subprocess.run(['git', 'fetch', 'origin', 'main'], check=True) -diff_cmd = "git diff main:dont_download.sh origin/main:dont_download.sh" -filter_cmd = "grep '^[+-]' | grep -v 'export COMMIT' | grep -v '^\+\+\+' | grep -v '^---'" -changes = subprocess.getoutput(f"{diff_cmd} | {filter_cmd} | wc -l") +diff_output = subprocess.run(['git', 'diff', 'main:dont_download.sh', 'origin/main:dont_download.sh'], capture_output=True, text=True, check=True).stdout +lines = diff_output.split('\n') +changes = [line for line in lines if line.startswith('+') or line.startswith('-')] +changes = [line for line in changes if not line.startswith('+++') and not line.startswith('---') and 'export COMMIT' not in line] if int(changes) >= 1: print("There are changes to push:\n") + print(diff_output) + print('...\n') print(changes) print('...\n') subprocess.run(['git', 'push', 'origin', 'main'], check=True)