Skip to content

Commit

Permalink
save ci life
Browse files Browse the repository at this point in the history
  • Loading branch information
ydshieh committed Mar 11, 2024
1 parent dd1c905 commit 6d2ba88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/tests_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,9 @@ def parse_commit_message(commit_message: str) -> Dict[str, bool]:
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

Expand All @@ -1243,7 +1244,7 @@ def parse_commit_message(commit_message: str) -> Dict[str, bool]:
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:
Expand Down

0 comments on commit 6d2ba88

Please sign in to comment.