From 8a8c2ed8d528f7af4a0ebc9f67c1d8a53207cae8 Mon Sep 17 00:00:00 2001 From: "Jose R. Gonzalez" Date: Wed, 11 Oct 2023 14:01:46 -0500 Subject: [PATCH] Prevent early exit in cases where a non-workflow file is also modified alongside workflow files Signed-off-by: Jose R. Gonzalez --- scripts/src/workflowtesting/checkprforci.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/src/workflowtesting/checkprforci.py b/scripts/src/workflowtesting/checkprforci.py index 0e7f487a..0ee991f8 100644 --- a/scripts/src/workflowtesting/checkprforci.py +++ b/scripts/src/workflowtesting/checkprforci.py @@ -19,7 +19,7 @@ def check_if_ci_only_is_modified(api_url): files = prartifact.get_modified_files(api_url) workflow_files = [ - re.compile(r".github/workflows/.*"), + re.compile(r".github/(workflows|actions)/.*"), re.compile(r"scripts/.*"), re.compile(r"tests/.*"), ] @@ -33,19 +33,27 @@ def check_if_ci_only_is_modified(api_url): re.compile(r"docs/([\w-]+)\.md"), ] + print(f"[INFO] The following files were modified in this PR: {files}") + workflow_found = False others_found = False tests_included = False for filename in files: if any([pattern.match(filename) for pattern in workflow_files]): + print(f"[DEBUG] Modified file {filename} is a workflow file.") workflow_found = True + # Tests are considered workflow files AND test files to inform other actions + # so we detect both separately. if any([pattern.match(filename) for pattern in test_files]): + print(f"[DEBUG] Modified file {filename} is also a test file.") tests_included = True elif any([pattern.match(filename) for pattern in skip_build_files]): + print(f"[DEBUG] Modified file {filename} is a skippable file.") others_found = True else: - return False + print(f"[DEBUG] Modified file {filename} did not match any file paths of interest. Ignoring.") + continue if others_found and not workflow_found: gitutils.add_output("do-not-build", "true")