From 758245bf208ac02d89fedac08faaf558352e65a0 Mon Sep 17 00:00:00 2001 From: noidlet Date: Mon, 18 May 2026 10:46:11 -0400 Subject: [PATCH 1/2] Fix duplicate profile check to handle deleted files The check_duplicates.py script was failing when a PR deleted a profile file. The script would try to open the deleted file for comparison, causing a FileNotFoundError. This fix adds an existence check before attempting to open the file, skipping deleted files with an informative message. --- .github/scripts/check_duplicates.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/scripts/check_duplicates.py b/.github/scripts/check_duplicates.py index b4bf01649d..ae0a26f687 100644 --- a/.github/scripts/check_duplicates.py +++ b/.github/scripts/check_duplicates.py @@ -112,9 +112,15 @@ def compare_components(prof1, prof2): print('\nNEW PROFILE:\n%s is a profile! Comparing to other profiles...' % file) os.chdir(file_directory) - for current_profile in os.listdir("./"): - new_profile = file_basename + new_profile = file_basename + + # Skip deleted files + if not os.path.exists(new_profile): + print("Skipping %s - file was deleted" % new_profile) + os.chdir(cwd) + continue + for current_profile in os.listdir("./"): # compare to YAML files that are not the same file # Compare only .yml files and only files that have not already been found to be a duplicate if current_profile != new_profile and Path(current_profile).suffix == ".yml" and (current_profile, new_profile) not in duplicate_pairs: From 732cc20f54b1c5067828d818b94432ea1f3f8b2c Mon Sep 17 00:00:00 2001 From: noidlet Date: Mon, 18 May 2026 11:15:52 -0400 Subject: [PATCH 2/2] Emit warning when profile files are deleted in PR --- .github/scripts/check_duplicates.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/scripts/check_duplicates.py b/.github/scripts/check_duplicates.py index ae0a26f687..65e2ae2ea6 100644 --- a/.github/scripts/check_duplicates.py +++ b/.github/scripts/check_duplicates.py @@ -5,6 +5,7 @@ cwd = os.getcwd() duplicate_pairs = [] +deleted_profiles = [] def compare_component_capabilities_unordered(comp1, comp2): for cap1 in comp1["capabilities"]: @@ -114,9 +115,10 @@ def compare_components(prof1, prof2): os.chdir(file_directory) new_profile = file_basename - # Skip deleted files + # Skip deleted files and track them for warning if not os.path.exists(new_profile): print("Skipping %s - file was deleted" % new_profile) + deleted_profiles.append(file) os.chdir(cwd) continue @@ -151,7 +153,12 @@ def compare_components(prof1, prof2): for duplicate in duplicate_pairs: f.write("%s == %s\n" % (duplicate[0], duplicate [1])) else: - f.write("Duplicate profile check: Passed - no duplicate profiles detected.") + f.write("Duplicate profile check: Passed - no duplicate profiles detected.\n") + + if deleted_profiles: + f.write("\n:warning: **Deleted profile files detected:**\n") + for deleted in deleted_profiles: + f.write("- `%s`\n" % deleted) with open("profile-comment-body.md", "r") as f: print("\n" + f.read())