MCPcopy Create free account
hub / github.com/apache/datafusion / main

Function main

ci/scripts/check_asf_yaml_status_checks.py:88–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86
87
88def main():
89 repo_root = os.path.dirname(
90 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
91 )
92 asf_yaml = os.path.join(repo_root, ".asf.yaml")
93 workflows_dir = os.path.join(repo_root, ".github", "workflows")
94
95 required_checks = get_required_checks(asf_yaml)
96 if not required_checks:
97 print("No required_status_checks found in .asf.yaml — nothing to validate.")
98 return
99
100 jobs = get_workflow_jobs(workflows_dir)
101 errors = []
102
103 for ctx in sorted(required_checks):
104 branches = ", ".join(sorted(required_checks[ctx]))
105 if ctx not in jobs:
106 errors.append(
107 f' - "{ctx}" (branch: {branches}): '
108 f"not found in any GitHub Actions workflow"
109 )
110 continue
111
112 # Check if ALL workflows providing this job have path filters
113 # (if at least one doesn't, the check will still run)
114 filtered_workflows = [
115 wf for wf, has_filter in jobs[ctx] if has_filter
116 ]
117 unfiltered_workflows = [
118 wf for wf, has_filter in jobs[ctx] if not has_filter
119 ]
120 if filtered_workflows and not unfiltered_workflows:
121 wf_list = ", ".join(filtered_workflows)
122 errors.append(
123 f' - "{ctx}" (branch: {branches}): '
124 f"workflow {wf_list} uses paths/paths-ignore filters on "
125 f"pull_request, so this check won't run for some PRs "
126 f"and will block merging"
127 )
128
129 if errors:
130 print("ERROR: Problems found with required_status_checks in .asf.yaml:\n")
131 print("\n".join(errors))
132 print()
133 print("Available job names across all workflows:")
134 for name in sorted(jobs):
135 print(f" - {name}")
136 sys.exit(1)
137
138 print(
139 f"OK: All {len(required_checks)} required_status_checks "
140 "match existing GitHub Actions jobs."
141 )
142
143
144if __name__ == "__main__":

Callers 1

Calls 4

get_required_checksFunction · 0.85
get_workflow_jobsFunction · 0.85
joinMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…