Parses the commit message to detect if a command is there to skip, force all or part of the CI. Args: commit_message (`str`): The commit message of the current commit. Returns: `Dict[str, bool]`: A dictionary of strings to bools with keys the following keys: `"skip"`,
(commit_message: str)
| 1024 | |
| 1025 | |
| 1026 | def parse_commit_message(commit_message: str) -> dict[str, bool]: |
| 1027 | """ |
| 1028 | Parses the commit message to detect if a command is there to skip, force all or part of the CI. |
| 1029 | |
| 1030 | Args: |
| 1031 | commit_message (`str`): The commit message of the current commit. |
| 1032 | |
| 1033 | Returns: |
| 1034 | `Dict[str, bool]`: A dictionary of strings to bools with keys the following keys: `"skip"`, |
| 1035 | `"test_all_models"` and `"test_all"`. |
| 1036 | """ |
| 1037 | if commit_message is None: |
| 1038 | return {"skip": False, "no_filter": False, "test_all": False} |
| 1039 | |
| 1040 | command_search = re.search(r"\[([^\]]*)\]", commit_message) |
| 1041 | if command_search is not None: |
| 1042 | command = command_search.groups()[0] |
| 1043 | command = command.lower().replace("-", " ").replace("_", " ") |
| 1044 | skip = command in ["ci skip", "skip ci", "circleci skip", "skip circleci"] |
| 1045 | no_filter = set(command.split(" ")) == {"no", "filter"} |
| 1046 | test_all = set(command.split(" ")) == {"test", "all"} |
| 1047 | return {"skip": skip, "no_filter": no_filter, "test_all": test_all} |
| 1048 | else: |
| 1049 | return {"skip": False, "no_filter": False, "test_all": False} |
| 1050 | |
| 1051 | |
| 1052 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…