{"record":{"id":"b445520e3311cc7d","repo":"OtterMind/Chat2DB","slug":"unsupported-github-event-event-name","errorCode":null,"errorMessage":"Unsupported GitHub event: {event_name}","messagePattern":"Unsupported GitHub event: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"script/github/notify_qq.py","lineNumber":479,"sourceCode":"        html_url = _clean_text(discussion.get(\"html_url\"), 500)\n        if include_url and html_url:\n            lines.append(f\"链接：{html_url}\")\n        message = _join_message_lines(lines)\n        return message if include_url else _remove_urls(message)\n\n    if event_name == \"issues\":\n        item = payload.get(\"issue\") or {}\n        item_name = \"Issue\"\n        action_label = ISSUE_ACTIONS.get(action, f\"状态已变更（{action}）\")\n    elif event_name == \"pull_request_target\":\n        item = payload.get(\"pull_request\") or {}\n        item_name = \"PR\"\n        if action == \"closed\" and item.get(\"merged\"):\n            action_label = \"已合并\"\n        else:\n            action_label = PULL_REQUEST_ACTIONS.get(action, f\"状态已变更（{action}）\")\n    else:\n        raise ValueError(f\"Unsupported GitHub event: {event_name}\")\n\n    number = item.get(\"number\") or payload.get(\"number\") or \"?\"\n    title = _clean_text(item.get(\"title\"), 220)\n    detail = _event_detail(event_name, action, payload)\n    html_url = _clean_text(item.get(\"html_url\"), 500)\n\n    lines = [\n        f\"{prefix} {item_name} #{number} {action_label}\",\n        f\"标题：{title}\",\n        f\"操作者：{sender}\",\n    ]\n    if detail and not detail.endswith(\"：\"):\n        lines.append(detail)\n    if include_url and html_url:\n        lines.append(f\"链接：{html_url}\")\n\n    message = _join_message_lines(lines)\n    return message if include_url else _remove_urls(message)","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/script/github/notify_qq.py#L461-L497","documentation":"Raised by build_notification (notify_qq.py:479) as a ValueError when event_name matches none of the handled events (workflow_dispatch, issue_comment, pull_request_review, pull_request_review_comment, release, deployment/deployment_status, discussion, issues, pull_request_target). It is the fall-through guard at the end of the event dispatch chain.","triggerScenarios":"The GitHub Actions workflow triggers the notifier on an event type the script does not support, e.g. push, schedule, check_run, create, fork, or a misspelled/custom event. GITHUB_EVENT_NAME carries that value into build_notification.","commonSituations":"Adding the workflow to a new event trigger (on: push:) without extending build_notification; a reusable workflow triggered with an unexpected event; GITHUB_EVENT_NAME set manually to an unsupported value during testing.","solutions":["Restrict the workflow's 'on:' triggers to the events build_notification handles.","If a new event is needed, add a branch to build_notification and the appropriate action-label map.","For test dispatches, use workflow_dispatch (which is handled)."],"exampleFix":"# before: on: [push, issues, pull_request_target]\n# after: on: [issues, pull_request_target, issue_comment, release]","handlingStrategy":"validation","validationCode":"SUPPORTED = {\n    \"workflow_dispatch\", \"issue_comment\", \"pull_request_review\",\n    \"pull_request_review_comment\", \"release\", \"deployment\",\n    \"deployment_status\", \"discussion\", \"issues\", \"pull_request_target\",\n}\nif event_name not in SUPPORTED:\n    raise SystemExit(f\"event {event_name!r} not supported; restrict workflow triggers\")","typeGuard":"def is_supported_event(event_name: str) -> bool:\n    return event_name in {\n        \"workflow_dispatch\", \"issue_comment\", \"pull_request_review\",\n        \"pull_request_review_comment\", \"release\", \"deployment\",\n        \"deployment_status\", \"discussion\", \"issues\", \"pull_request_target\",\n    }","tryCatchPattern":"try:\n    message = build_notification(event_name, payload, repository, actor, run_url, include_url=include_url)\nexcept ValueError as error:\n    print(f\"skipping unsupported event: {error}\", file=sys.stderr)\n    sys.exit(0)  # or a non-fatal return","preventionTips":["Keep the workflow 'on:' trigger list in sync with the events build_notification handles.","Add new events to the dispatch chain before enabling them as triggers."],"tags":["github-actions","notification","validation","events"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}