Files
ml-sdk/script/make_utils/actionlint_check_with_whitelists.py
zeekay bde2e2531b Initial commit: Lux FHE ML SDK
Machine Learning with FHE - fork of Zama Concrete-ML
- Built-in FHE-friendly ML models
- scikit-learn compatible API
- PyTorch model conversion
- Quantization-aware training
2025-12-27 21:08:09 -08:00

60 lines
1.5 KiB
Python

""" Check an actionlint log against some whitelists """
import sys
from typing import Set
# Exact lines which are whitelisted
whitelisted_lines: Set[str] = set()
# Pattern which are whitelisted
whitelisted_pattern: Set[str] = {
"matrix.runs_on",
"matrix.python_version",
"",
"matrix: ${{ fromJSON(format('{{\"include\":{0}}}', "
"needs.start-runner-linux.outputs.matrix)) }}",
"matrix: ${{ fromJSON(format('{{\"include\":{0}}}', "
"needs.matrix-preparation.outputs.macos-matrix)) }}",
'when a reusable workflow is called with "uses", "strategy" is not available.'
' only following keys are allowed: "name", "uses", "with", "secrets", "needs",'
' "if", and "permissions" in job "run-job"',
'"secrets" section is scalar node but mapping node is expected',
"secrets: inherit",
"^~~~~~~",
"|",
"strategy:",
}
def main():
"""Do the test
Raises:
ValueError: if non whitelisted error occurred
"""
status = 0
bad_lines = []
for line in sys.stdin:
if line in whitelisted_lines:
continue
is_bad_line = True
for pattern in whitelisted_pattern:
if pattern in line:
is_bad_line = False
break
if is_bad_line:
print("->", line)
status = 1
bad_lines.append(line)
if status:
errors = "\n------\n".join(bad_lines)
raise ValueError("Some non whitelisted errors, look at full log file:" f"{errors}")
if __name__ == "__main__":
main()