MCPcopy Create free account
hub / github.com/FastLED/FastLED / main

Function main

ci/tools/gh/limit_agent_pr_workflows.py:178–212  ·  view source on GitHub ↗
(argv: list[str] | None = None)

Source from the content-addressed store, hash-verified

176
177
178def main(argv: list[str] | None = None) -> int:
179 args = parse_args(sys.argv[1:] if argv is None else argv)
180 allowlist = DEFAULT_PR_ALLOWLIST | set(args.allow_pr)
181
182 if args.print_allowlist:
183 for filename in sorted(allowlist):
184 print(filename)
185 return 0
186
187 workflows_dir = args.workflows_dir
188 if not workflows_dir.is_dir():
189 print(f"Workflow directory not found: {workflows_dir}", file=sys.stderr)
190 return 2
191
192 results = [
193 remove_pull_request_if_needed(path, allow_pr=path.name in allowlist)
194 for path in workflow_files(workflows_dir)
195 ]
196 changed = [result for result in results if result.changed]
197
198 for result in changed:
199 print(result.path.as_posix())
200 for change in result.changes:
201 print(f" - {change}")
202
203 if args.apply:
204 for result in changed:
205 result.path.write_text(result.updated_text, encoding="utf-8")
206 print(f"Updated {len(changed)} workflow file(s).")
207 else:
208 print(f"Would update {len(changed)} workflow file(s). Pass --apply to rewrite.")
209
210 if args.check and changed:
211 return 1
212 return 0
213
214
215if __name__ == "__main__":

Callers 1

Calls 5

workflow_filesFunction · 0.85
parse_argsFunction · 0.70
setClass · 0.50
printFunction · 0.50

Tested by

no test coverage detected