Load and parse a YAML task file
(self, file_path: str)
| 20 | self.variables = {} |
| 21 | |
| 22 | def load_task(self, file_path: str) -> Dict[str, Any]: |
| 23 | """Load and parse a YAML task file""" |
| 24 | with open(file_path, "r", encoding="utf-8") as f: |
| 25 | content = f.read() |
| 26 | |
| 27 | # Expand environment variables first |
| 28 | content = self._expand_env_variables(content) |
| 29 | |
| 30 | # Parse YAML |
| 31 | task_data = yaml.safe_load(content) |
| 32 | |
| 33 | # Validate task format |
| 34 | self._validate_task(task_data) |
| 35 | |
| 36 | return task_data |
| 37 | |
| 38 | def _expand_env_variables(self, content: str) -> str: |
| 39 | """Expand environment variables and template variables""" |