From 7cecfc88fd186aebeed3ea69e7b9568524fd199d Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Fri, 10 May 2024 23:49:53 +0300 Subject: [PATCH] better --- .github/scripts/changed_apps.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/scripts/changed_apps.py b/.github/scripts/changed_apps.py index 0c3b24d50f..d7f4c4fab1 100644 --- a/.github/scripts/changed_apps.py +++ b/.github/scripts/changed_apps.py @@ -26,8 +26,8 @@ # Print to stderr, in order to keep stdout only for data print(f"Changed files: {changed_files}", file=sys.stderr) +seen = set() matrix = [] -tracker = {} for file in changed_files: match = APP_REGEX.match(file) if not match: @@ -40,19 +40,21 @@ full_name, TEST_VALUES_DIR, ).glob("*.yaml"): - matrix.append( - { - "train": match.group(1), - "app": match.group(2), - "test_file": file.name, - } - ) - print( - f"Detected changed item for {full_name}: {json.dumps(matrix[-1], indent=2)}", - file=sys.stderr, - ) + item_tuple = (match.group(1), match.group(2), file.name) + if item_tuple not in seen: + seen.add(item_tuple) + matrix.append( + { + "train": match.group(1), + "app": match.group(2), + "test_file": file.name, + } + ) + print( + f"Detected changed item for {full_name}: {json.dumps(matrix[-1], indent=2)}", + file=sys.stderr, + ) -matrix = set(matrix) print(json.dumps({"include": matrix})) # This should look like: # {