INNER CODE UNIT · Python
_load
jacobdjwilson/awesome-annual-security-reports · .github/scripts/apply-triage-label.py:40
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}'.")
required_keys = ["labels", "default_label_color"]
for k in required_keys:
if k not in triage_cfg:
raise KeyError(f"Missing required key '{k}' in 'workflow.issue_triage' of '{self.config_path}'.")