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)
| 1190 | |
| 1191 | |
| 1192 | def parse_commit_message(commit_message: str) -> Dict[str, bool]: |
| 1193 | """ |
| 1194 | Parses the commit message to detect if a command is there to skip, force all or part of the CI. |
| 1195 | |
| 1196 | Args: |
| 1197 | commit_message (`str`): The commit message of the current commit. |
| 1198 | |
| 1199 | Returns: |
| 1200 | `Dict[str, bool]`: A dictionary of strings to bools with keys the following keys: `"skip"`, |
| 1201 | `"test_all_models"` and `"test_all"`. |
| 1202 | """ |
| 1203 | if commit_message is None: |
| 1204 | return {"skip": False, "no_filter": False, "test_all": False} |
| 1205 | |
| 1206 | command_search = re.search(r"\[([^\]]*)\]", commit_message) |
| 1207 | if command_search is not None: |
| 1208 | command = command_search.groups()[0] |
| 1209 | command = command.lower().replace("-", " ").replace("_", " ") |
| 1210 | skip = command in ["ci skip", "skip ci", "circleci skip", "skip circleci"] |
| 1211 | no_filter = set(command.split(" ")) == {"no", "filter"} |
| 1212 | test_all = set(command.split(" ")) == {"test", "all"} |
| 1213 | return {"skip": skip, "no_filter": no_filter, "test_all": test_all} |
| 1214 | else: |
| 1215 | return {"skip": False, "no_filter": False, "test_all": False} |
| 1216 | |
| 1217 | |
| 1218 | if __name__ == "__main__": |
no test coverage detected