INNER CODE UNIT · Python
__init__
jacobdjwilson/awesome-annual-security-reports · .github/scripts/apply-triage-label.py:36
def __init__(self, artifacts_dir: str = ".github/artifacts") -> None:
self.config_path = Path(artifacts_dir) / "workflow-config.json"
self.config = self._load()
def _load(self) -> Dict[str, Any]:
if not self.config_path.exists():
raise FileNotFoundError(f"Missing required artifact: '{self.config_path}'.")
try:
with open(self.config_path, "r", encoding="utf-8") as f:
data = json.load(f)
except Exception as e:
raise ValueError(f"Failed to parse JSON artifact '{self.config_path}': {e}") from e
workflow = data.get("workflow", {})
triage_cfg = workflow.get("issue_triage")
if not triage_cfg or not isinstance(triage_cfg, dict):
raise KeyError(f"Missing 'workflow.issue_triage' in '{self.config_path}'.")