GitHubPullRequestEventModel#

pydantic model safir.github.webhooks.GitHubPullRequestEventModel#

A Pydantic model for a pull_request webhook.

https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request

Parameters:

data (Any) –

Show JSON schema
{
   "title": "GitHubPullRequestEventModel",
   "description": "A Pydantic model for a ``pull_request`` webhook.\n\nhttps://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request",
   "type": "object",
   "properties": {
      "repository": {
         "allOf": [
            {
               "$ref": "#/$defs/GitHubRepositoryModel"
            }
         ],
         "description": "The repository that the pull request was opened against."
      },
      "installation": {
         "allOf": [
            {
               "$ref": "#/$defs/GitHubAppInstallationModel"
            }
         ],
         "description": "Information about the GitHub App installation."
      },
      "action": {
         "allOf": [
            {
               "$ref": "#/$defs/GitHubPullRequestEventAction"
            }
         ],
         "description": "The action that was performed."
      },
      "number": {
         "description": "Pull request number",
         "title": "Number",
         "type": "integer"
      },
      "pull_request": {
         "allOf": [
            {
               "$ref": "#/$defs/GitHubPullRequestModel"
            }
         ],
         "description": "Information about the pull request."
      }
   },
   "$defs": {
      "GitHubAppInstallationModel": {
         "description": "A Pydantic model for the ``installation`` field found in webhook\npayloads for GitHub Apps.",
         "properties": {
            "id": {
               "description": "The installation ID.",
               "title": "Id",
               "type": "integer"
            }
         },
         "required": [
            "id"
         ],
         "title": "GitHubAppInstallationModel",
         "type": "object"
      },
      "GitHubPullRequestEventAction": {
         "description": "The action performed on a GitHub ``pull_request`` webhook\n(`GitHubPullRequestEventModel`).",
         "enum": [
            "assigned",
            "auto_merge_disabled",
            "auto_merge_enabled",
            "closed",
            "converted_to_draft",
            "demilestoned",
            "dequeued",
            "edited",
            "labeled",
            "locked",
            "milestoned",
            "opened",
            "ready_for_review",
            "reopened",
            "review_request_removed",
            "review_requested",
            "synchronize",
            "unassigned",
            "unlabeled",
            "unlocked"
         ],
         "title": "GitHubPullRequestEventAction",
         "type": "string"
      },
      "GitHubPullRequestModel": {
         "description": "A Pydantic model for a GitHub Pull Request.\n\nThis is also the ``pull_request`` field inside the\n`~safir.github.webhooks.GitHubPullRequestEventModel`.\n\nhttps://docs.github.com/en/rest/pulls/pulls#get-a-pull-request",
         "properties": {
            "html_url": {
               "description": "Web URL of the PR.",
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "title": "Html Url",
               "type": "string"
            },
            "number": {
               "description": "Pull request number.",
               "title": "Number",
               "type": "integer"
            },
            "title": {
               "description": "Title of the PR.",
               "title": "Title",
               "type": "string"
            },
            "state": {
               "allOf": [
                  {
                     "$ref": "#/$defs/GitHubPullState"
                  }
               ],
               "description": "Whether the PR is opened or closed."
            },
            "draft": {
               "description": "True if the PR is a draft.",
               "title": "Draft",
               "type": "boolean"
            },
            "merged": {
               "description": "True if the PR is merged.",
               "title": "Merged",
               "type": "boolean"
            },
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/GitHubUserModel"
                  }
               ],
               "description": "The user that opened the PR."
            }
         },
         "required": [
            "html_url",
            "number",
            "title",
            "state",
            "draft",
            "merged",
            "user"
         ],
         "title": "GitHubPullRequestModel",
         "type": "object"
      },
      "GitHubPullState": {
         "description": "The state of a GitHub pull request (PR).\n\nhttps://docs.github.com/en/rest/pulls/pulls#get-a-pull-request",
         "enum": [
            "open",
            "closed"
         ],
         "title": "GitHubPullState",
         "type": "string"
      },
      "GitHubRepoOwnerModel": {
         "description": "A Pydantic model for the ``owner`` field found in repository objects.\n\nhttps://docs.github.com/en/rest/repos/repos#get-a-repository",
         "properties": {
            "login": {
               "description": "Login name of the owner (either a user or an organization).",
               "examples": [
                  "lsst-sqre"
               ],
               "title": "Login name",
               "type": "string"
            }
         },
         "required": [
            "login"
         ],
         "title": "GitHubRepoOwnerModel",
         "type": "object"
      },
      "GitHubRepositoryModel": {
         "description": "A Pydantic model for the ``repository`` field, often found in webhook\npayloads.\n\nhttps://docs.github.com/en/rest/repos/repos#get-a-repository",
         "properties": {
            "name": {
               "description": "Excludes owner prefix.",
               "examples": [
                  "times-square-demo"
               ],
               "title": "Repository name",
               "type": "string"
            },
            "full_name": {
               "description": "Full name, including owner prefix (e.g. ``lsst-sqre/times-square-demo``).)",
               "examples": [
                  "lsst-sqre/times-square-demo"
               ],
               "title": "Full name",
               "type": "string"
            },
            "owner": {
               "allOf": [
                  {
                     "$ref": "#/$defs/GitHubRepoOwnerModel"
                  }
               ],
               "description": "The repository's owner."
            },
            "default_branch": {
               "description": "The default branch (e.g. main).",
               "examples": [
                  "main"
               ],
               "title": "Default Branch",
               "type": "string"
            },
            "html_url": {
               "description": "URL of the repository for browsers.",
               "examples": [
                  "https://github.com/lsst-sqre/times-square-demo"
               ],
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "title": "Html Url",
               "type": "string"
            },
            "branches_url": {
               "description": "URI template for the repo's branches endpoint.",
               "examples": [
                  "https://github.com/lsst-sqre/times-square-demo/branches{/branch}"
               ],
               "title": "Branches Url",
               "type": "string"
            },
            "contents_url": {
               "description": "URI template for the contents endpoint.",
               "examples": [
                  "https://github.com/lsst-sqre/times-square-demo/contents/{+path}"
               ],
               "title": "Contents Url",
               "type": "string"
            },
            "trees_url": {
               "description": "URI template for the Git tree API.",
               "examples": [
                  "https://github.com/lsst-sqre/times-square-demo/git/trees{/sha}"
               ],
               "title": "Trees Url",
               "type": "string"
            },
            "blobs_url": {
               "description": "URI template for the Git blobs API.",
               "examples": [
                  "https://github.com/lsst-sqre/times-square-demo/git/blobs{/sha}"
               ],
               "title": "Blobs Url",
               "type": "string"
            }
         },
         "required": [
            "name",
            "full_name",
            "owner",
            "default_branch",
            "html_url",
            "branches_url",
            "contents_url",
            "trees_url",
            "blobs_url"
         ],
         "title": "GitHubRepositoryModel",
         "type": "object"
      },
      "GitHubUserModel": {
         "description": "A Pydantic model for the ``user`` field found in GitHub API resources.\n\nThis contains brief (public) info about a user.",
         "properties": {
            "login": {
               "description": "GitHub username.",
               "title": "Login name",
               "type": "string"
            },
            "html_url": {
               "description": "Homepage for the user on GitHub.",
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "title": "Profile URL",
               "type": "string"
            },
            "url": {
               "description": "URL for the user's resource in the GitHub API.",
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "title": "API URL",
               "type": "string"
            },
            "avatar_url": {
               "description": "URL to the user's avatar.",
               "format": "uri",
               "maxLength": 2083,
               "minLength": 1,
               "title": "Avatar image URL",
               "type": "string"
            }
         },
         "required": [
            "login",
            "html_url",
            "url",
            "avatar_url"
         ],
         "title": "GitHubUserModel",
         "type": "object"
      }
   },
   "required": [
      "repository",
      "installation",
      "action",
      "number",
      "pull_request"
   ]
}

Fields:
field action: GitHubPullRequestEventAction [Required]#

The action that was performed.

field installation: GitHubAppInstallationModel [Required]#

Information about the GitHub App installation.

field number: int [Required]#

Pull request number

field pull_request: GitHubPullRequestModel [Required]#

Information about the pull request.

field repository: GitHubRepositoryModel [Required]#

The repository that the pull request was opened against.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.