{
  "$id": "https://firefox-ci-tc.services.mozilla.com/schemas/github/v1/webhook-check-run-payload.json#",
  "$schema": "https://firefox-ci-tc.services.mozilla.com/schemas/common/metaschema.json#",
  "additionalProperties": true,
  "description": "Validates GitHub check run event webhook payload.\n",
  "properties": {
    "action": {
      "description": "The action performed on the check run.\nKnown values: created, completed, rerequested, requested_action.\nGitHub may add new action types; validation accepts any non-empty string.\n",
      "minLength": 1,
      "type": "string"
    },
    "check_run": {
      "additionalProperties": true,
      "properties": {
        "check_suite": {
          "additionalProperties": true,
          "properties": {
            "head_branch": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "minLength": 1,
                  "type": "string"
                }
              ]
            },
            "head_sha": {
              "pattern": "^[a-f0-9]{40}$",
              "type": "string"
            },
            "id": {
              "minimum": 1,
              "type": "integer"
            }
          },
          "required": [
            "id",
            "head_sha"
          ],
          "type": "object"
        },
        "conclusion": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "description": "The conclusion of the check run when status is completed.\nKnown values: success, failure, neutral, cancelled, skipped,\ntimed_out, action_required, stale.\nNote: Only GitHub can set 'stale'.\nGitHub may add new values; validation accepts any non-empty string.\n",
              "minLength": 1,
              "type": "string"
            }
          ]
        },
        "head_sha": {
          "pattern": "^[a-f0-9]{40}$",
          "type": "string"
        },
        "id": {
          "minimum": 1,
          "type": "integer"
        },
        "name": {
          "minLength": 1,
          "type": "string"
        },
        "pull_requests": {
          "items": {
            "additionalProperties": true,
            "properties": {
              "base": {
                "additionalProperties": true,
                "properties": {
                  "sha": {
                    "pattern": "^[a-f0-9]{40}$",
                    "type": "string"
                  }
                },
                "required": [
                  "sha"
                ],
                "type": "object"
              },
              "head": {
                "additionalProperties": true,
                "properties": {
                  "sha": {
                    "pattern": "^[a-f0-9]{40}$",
                    "type": "string"
                  }
                },
                "required": [
                  "sha"
                ],
                "type": "object"
              },
              "id": {
                "minimum": 1,
                "type": "integer"
              },
              "number": {
                "minimum": 1,
                "type": "integer"
              }
            },
            "required": [
              "id",
              "number",
              "head",
              "base"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "status": {
          "description": "The status of the check run.\nKnown values: queued, in_progress, completed, waiting, requested, pending.\nNote: GitHub Actions can set waiting, requested, or pending.\nGitHub may add new values; validation accepts any non-empty string.\n",
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "id",
        "head_sha",
        "status",
        "name",
        "check_suite",
        "pull_requests"
      ],
      "type": "object"
    },
    "installation": {
      "additionalProperties": true,
      "properties": {
        "id": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "repository": {
      "additionalProperties": true,
      "properties": {
        "full_name": {
          "pattern": "^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$",
          "type": "string"
        },
        "name": {
          "pattern": "^[A-Za-z0-9._-]+$",
          "type": "string"
        },
        "owner": {
          "additionalProperties": true,
          "anyOf": [
            {
              "required": [
                "name"
              ]
            },
            {
              "required": [
                "login"
              ]
            }
          ],
          "properties": {
            "login": {
              "pattern": "^([a-zA-Z0-9-_%\\[\\]]*)$",
              "type": "string"
            },
            "name": {
              "pattern": "^([a-zA-Z0-9-_%\\[\\]]*)$",
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "required": [
        "name",
        "full_name",
        "owner"
      ],
      "type": "object"
    },
    "sender": {
      "additionalProperties": true,
      "properties": {
        "login": {
          "pattern": "^([a-zA-Z0-9-_%\\[\\]]*)$",
          "type": "string"
        }
      },
      "required": [
        "login"
      ],
      "type": "object"
    }
  },
  "required": [
    "action",
    "check_run",
    "repository",
    "sender"
  ],
  "title": "GitHub Check Run Webhook Payload",
  "type": "object"
}