From e5eb55b88b7200e81144eaf7a2bf3001b2bd08e7 Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:58:06 +0100 Subject: [PATCH] Don't use a subset in test fetcher if on `main` branch (#28816) save ci life Co-authored-by: ydshieh --- utils/tests_fetcher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/tests_fetcher.py b/utils/tests_fetcher.py index a7a64c823f..21e19fd7d1 100644 --- a/utils/tests_fetcher.py +++ b/utils/tests_fetcher.py @@ -1232,8 +1232,9 @@ if __name__ == "__main__": if commit_flags["test_all"]: print("Force-launching all tests") + is_main_branch = not repo.head.is_detached and repo.head.ref == repo.refs.main diff_with_last_commit = args.diff_with_last_commit - if not diff_with_last_commit and not repo.head.is_detached and repo.head.ref == repo.refs.main: + if not diff_with_last_commit and is_main_branch: print("main branch detected, fetching tests against last commit.") diff_with_last_commit = True @@ -1243,7 +1244,7 @@ if __name__ == "__main__": args.output_file, diff_with_last_commit=diff_with_last_commit, json_output_file=args.json_output_file, - filter_models=not commit_flags["no_filter"], + filter_models=(not commit_flags["no_filter"] or is_main_branch), ) filter_tests(args.output_file, ["repo_utils"]) except Exception as e: