Extract all required_status_checks contexts from .asf.yaml.
(asf_yaml_path)
| 34 | |
| 35 | |
| 36 | def get_required_checks(asf_yaml_path): |
| 37 | """Extract all required_status_checks contexts from .asf.yaml.""" |
| 38 | with open(asf_yaml_path) as f: |
| 39 | config = yaml.safe_load(f) |
| 40 | |
| 41 | checks = {} # context -> list of branches requiring it |
| 42 | branches = config.get("github", {}).get("protected_branches", {}) |
| 43 | for branch, settings in branches.items(): |
| 44 | contexts = ( |
| 45 | settings.get("required_status_checks", {}).get("contexts", []) |
| 46 | ) |
| 47 | for ctx in contexts: |
| 48 | checks.setdefault(ctx, []).append(branch) |
| 49 | |
| 50 | return checks |
| 51 | |
| 52 | |
| 53 | def get_workflow_jobs(workflows_dir): |