{
  "$id": "https://firefox-ci-tc.services.mozilla.com/schemas/github/v1/webhook-push-payload.json#",
  "$schema": "https://firefox-ci-tc.services.mozilla.com/schemas/common/metaschema.json#",
  "additionalProperties": true,
  "description": "Validates GitHub push event webhook payload.\n",
  "properties": {
    "after": {
      "pattern": "^[a-f0-9]{40}$",
      "type": "string"
    },
    "before": {
      "pattern": "^[a-f0-9]{40}$",
      "type": "string"
    },
    "commits": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "id": {
            "pattern": "^[a-f0-9]{40}$",
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "message"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "head_commit": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "additionalProperties": true,
          "properties": {
            "id": {
              "pattern": "^[a-f0-9]{40}$",
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "message"
          ],
          "type": "object"
        }
      ]
    },
    "installation": {
      "additionalProperties": true,
      "properties": {
        "id": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "id"
      ],
      "type": "object"
    },
    "pusher": {
      "additionalProperties": true,
      "properties": {
        "name": {
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "ref": {
      "pattern": "^refs/(heads|tags)/.*$",
      "type": "string"
    },
    "repository": {
      "additionalProperties": true,
      "properties": {
        "clone_url": {
          "format": "uri",
          "type": "string"
        },
        "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",
        "clone_url",
        "owner"
      ],
      "type": "object"
    },
    "sender": {
      "additionalProperties": true,
      "properties": {
        "login": {
          "pattern": "^([a-zA-Z0-9-_%\\[\\]]*)$",
          "type": "string"
        }
      },
      "required": [
        "login"
      ],
      "type": "object"
    }
  },
  "required": [
    "ref",
    "before",
    "after",
    "repository",
    "pusher",
    "commits",
    "sender"
  ],
  "title": "GitHub Push Webhook Payload",
  "type": "object"
}