Download .github/scripts/check_ci_results.py from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 964 Bytes
-
https://huggingface.co/SaylorTwift/codex/resolve/main/.github/scripts/check_ci_results.py
- Command line
-
hf download hf://SaylorTwift/codex/.github/scripts/check_ci_results.py
-
curl -L -o check_ci_results.py https://huggingface.co/SaylorTwift/codex/resolve/main/.github/scripts/check_ci_results.py
964 Bytes
| #!/usr/bin/env python3 | |
| """Fail a terminal CI job unless every serialized dependency succeeded. | |
| Parent workflows pass GitHub's `toJSON(needs)` object through the NEEDS | |
| environment variable. Treat skipped and cancelled dependencies as failures too: | |
| for a required fan-in job, only an explicit success is safe to accept. | |
| """ | |
| import json | |
| import os | |
| def main() -> None: | |
| # Keep result policy in one script so blocking-ci and postmerge-ci cannot | |
| # drift in how they interpret dependency conclusions. | |
| needs = json.loads(os.environ["NEEDS"]) | |
| failures = sorted( | |
| (name, dependency["result"]) | |
| for name, dependency in needs.items() | |
| if dependency["result"] != "success" | |
| ) | |
| if failures: | |
| print("CI dependencies did not succeed:") | |
| for name, result in failures: | |
| print(f"{name}: {result}") | |
| raise SystemExit(1) | |
| print("All CI dependencies succeeded.") | |
| if __name__ == "__main__": | |
| main() | |