From 44b0096747563612d6acf191f9932d719c1b4263 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Tue, 29 Sep 2026 15:45:39 +0000 Subject: [PATCH] :bug: fix pr stack base sha can be null --- .../v2022_11_28/models/group_0204.py | 4 ++- .../v2022_11_28/types/group_0204.py | 5 ++-- .../v2026_03_10/models/group_0204.py | 4 ++- .../v2026_03_10/types/group_0204.py | 5 ++-- .../ghec_v2022_11_28/models/group_0338.py | 4 ++- .../ghec_v2022_11_28/types/group_0338.py | 5 ++-- .../ghec_v2026_03_10/models/group_0338.py | 4 ++- .../ghec_v2026_03_10/types/group_0338.py | 5 ++-- .../githubkit_schemas/versions.lock | 1 + pyproject.toml | 26 ++++++++++++++++--- 10 files changed, 47 insertions(+), 16 deletions(-) diff --git a/packages/githubkit-schemas-2022-11-28/githubkit_schemas/v2022_11_28/models/group_0204.py b/packages/githubkit-schemas-2022-11-28/githubkit_schemas/v2022_11_28/models/group_0204.py index 3878c7f72..b13f5678f 100644 --- a/packages/githubkit-schemas-2022-11-28/githubkit_schemas/v2022_11_28/models/group_0204.py +++ b/packages/githubkit-schemas-2022-11-28/githubkit_schemas/v2022_11_28/models/group_0204.py @@ -9,6 +9,8 @@ from __future__ import annotations +from typing import Union + from pydantic import Field from githubkit.compat import GitHubModel, model_rebuild @@ -46,7 +48,7 @@ class PullRequestStackPropBase(GitHubModel): ref: str = Field( description="The base ref of the stack this pull request belongs to." ) - sha: str = Field( + sha: Union[str, None] = Field( description="The base SHA of the stack this pull request belongs to." ) diff --git a/packages/githubkit-schemas-2022-11-28/githubkit_schemas/v2022_11_28/types/group_0204.py b/packages/githubkit-schemas-2022-11-28/githubkit_schemas/v2022_11_28/types/group_0204.py index ed7a391e4..ee84972df 100644 --- a/packages/githubkit-schemas-2022-11-28/githubkit_schemas/v2022_11_28/types/group_0204.py +++ b/packages/githubkit-schemas-2022-11-28/githubkit_schemas/v2022_11_28/types/group_0204.py @@ -9,6 +9,7 @@ from __future__ import annotations +from typing import Union from typing_extensions import NotRequired, TypedDict @@ -42,14 +43,14 @@ class PullRequestStackPropBaseType(TypedDict): """PullRequestStackPropBase""" ref: str - sha: str + sha: Union[str, None] class PullRequestStackPropBaseTypeForResponse(TypedDict): """PullRequestStackPropBase""" ref: str - sha: str + sha: Union[str, None] __all__ = ( diff --git a/packages/githubkit-schemas-2026-03-10/githubkit_schemas/v2026_03_10/models/group_0204.py b/packages/githubkit-schemas-2026-03-10/githubkit_schemas/v2026_03_10/models/group_0204.py index 3878c7f72..b13f5678f 100644 --- a/packages/githubkit-schemas-2026-03-10/githubkit_schemas/v2026_03_10/models/group_0204.py +++ b/packages/githubkit-schemas-2026-03-10/githubkit_schemas/v2026_03_10/models/group_0204.py @@ -9,6 +9,8 @@ from __future__ import annotations +from typing import Union + from pydantic import Field from githubkit.compat import GitHubModel, model_rebuild @@ -46,7 +48,7 @@ class PullRequestStackPropBase(GitHubModel): ref: str = Field( description="The base ref of the stack this pull request belongs to." ) - sha: str = Field( + sha: Union[str, None] = Field( description="The base SHA of the stack this pull request belongs to." ) diff --git a/packages/githubkit-schemas-2026-03-10/githubkit_schemas/v2026_03_10/types/group_0204.py b/packages/githubkit-schemas-2026-03-10/githubkit_schemas/v2026_03_10/types/group_0204.py index ed7a391e4..ee84972df 100644 --- a/packages/githubkit-schemas-2026-03-10/githubkit_schemas/v2026_03_10/types/group_0204.py +++ b/packages/githubkit-schemas-2026-03-10/githubkit_schemas/v2026_03_10/types/group_0204.py @@ -9,6 +9,7 @@ from __future__ import annotations +from typing import Union from typing_extensions import NotRequired, TypedDict @@ -42,14 +43,14 @@ class PullRequestStackPropBaseType(TypedDict): """PullRequestStackPropBase""" ref: str - sha: str + sha: Union[str, None] class PullRequestStackPropBaseTypeForResponse(TypedDict): """PullRequestStackPropBase""" ref: str - sha: str + sha: Union[str, None] __all__ = ( diff --git a/packages/githubkit-schemas-ghec-2022-11-28/githubkit_schemas/ghec_v2022_11_28/models/group_0338.py b/packages/githubkit-schemas-ghec-2022-11-28/githubkit_schemas/ghec_v2022_11_28/models/group_0338.py index 3878c7f72..b13f5678f 100644 --- a/packages/githubkit-schemas-ghec-2022-11-28/githubkit_schemas/ghec_v2022_11_28/models/group_0338.py +++ b/packages/githubkit-schemas-ghec-2022-11-28/githubkit_schemas/ghec_v2022_11_28/models/group_0338.py @@ -9,6 +9,8 @@ from __future__ import annotations +from typing import Union + from pydantic import Field from githubkit.compat import GitHubModel, model_rebuild @@ -46,7 +48,7 @@ class PullRequestStackPropBase(GitHubModel): ref: str = Field( description="The base ref of the stack this pull request belongs to." ) - sha: str = Field( + sha: Union[str, None] = Field( description="The base SHA of the stack this pull request belongs to." ) diff --git a/packages/githubkit-schemas-ghec-2022-11-28/githubkit_schemas/ghec_v2022_11_28/types/group_0338.py b/packages/githubkit-schemas-ghec-2022-11-28/githubkit_schemas/ghec_v2022_11_28/types/group_0338.py index ed7a391e4..ee84972df 100644 --- a/packages/githubkit-schemas-ghec-2022-11-28/githubkit_schemas/ghec_v2022_11_28/types/group_0338.py +++ b/packages/githubkit-schemas-ghec-2022-11-28/githubkit_schemas/ghec_v2022_11_28/types/group_0338.py @@ -9,6 +9,7 @@ from __future__ import annotations +from typing import Union from typing_extensions import NotRequired, TypedDict @@ -42,14 +43,14 @@ class PullRequestStackPropBaseType(TypedDict): """PullRequestStackPropBase""" ref: str - sha: str + sha: Union[str, None] class PullRequestStackPropBaseTypeForResponse(TypedDict): """PullRequestStackPropBase""" ref: str - sha: str + sha: Union[str, None] __all__ = ( diff --git a/packages/githubkit-schemas-ghec-2026-03-10/githubkit_schemas/ghec_v2026_03_10/models/group_0338.py b/packages/githubkit-schemas-ghec-2026-03-10/githubkit_schemas/ghec_v2026_03_10/models/group_0338.py index 3878c7f72..b13f5678f 100644 --- a/packages/githubkit-schemas-ghec-2026-03-10/githubkit_schemas/ghec_v2026_03_10/models/group_0338.py +++ b/packages/githubkit-schemas-ghec-2026-03-10/githubkit_schemas/ghec_v2026_03_10/models/group_0338.py @@ -9,6 +9,8 @@ from __future__ import annotations +from typing import Union + from pydantic import Field from githubkit.compat import GitHubModel, model_rebuild @@ -46,7 +48,7 @@ class PullRequestStackPropBase(GitHubModel): ref: str = Field( description="The base ref of the stack this pull request belongs to." ) - sha: str = Field( + sha: Union[str, None] = Field( description="The base SHA of the stack this pull request belongs to." ) diff --git a/packages/githubkit-schemas-ghec-2026-03-10/githubkit_schemas/ghec_v2026_03_10/types/group_0338.py b/packages/githubkit-schemas-ghec-2026-03-10/githubkit_schemas/ghec_v2026_03_10/types/group_0338.py index ed7a391e4..ee84972df 100644 --- a/packages/githubkit-schemas-ghec-2026-03-10/githubkit_schemas/ghec_v2026_03_10/types/group_0338.py +++ b/packages/githubkit-schemas-ghec-2026-03-10/githubkit_schemas/ghec_v2026_03_10/types/group_0338.py @@ -9,6 +9,7 @@ from __future__ import annotations +from typing import Union from typing_extensions import NotRequired, TypedDict @@ -42,14 +43,14 @@ class PullRequestStackPropBaseType(TypedDict): """PullRequestStackPropBase""" ref: str - sha: str + sha: Union[str, None] class PullRequestStackPropBaseTypeForResponse(TypedDict): """PullRequestStackPropBase""" ref: str - sha: str + sha: Union[str, None] __all__ = ( diff --git a/packages/githubkit-schemas/githubkit_schemas/versions.lock b/packages/githubkit-schemas/githubkit_schemas/versions.lock index 96e99cae3..ee857f16d 100644 --- a/packages/githubkit-schemas/githubkit_schemas/versions.lock +++ b/packages/githubkit-schemas/githubkit_schemas/versions.lock @@ -80,6 +80,7 @@ target_descriptions = ["ghec-2022-11-28", "ghec-2026-03-10"] "/components/schemas/pull-request/properties/head/properties/user" = {anyOf = [{type = "null"}, {"$ref" = "#/components/schemas/simple-user"}], "$ref" = ""} "/components/schemas/pull-request/properties/head/properties/repo" = {anyOf = [{type = "null"}, {"$ref" = "#/components/schemas/repository"}], "$ref" = ""} "/components/schemas/pull-request-simple/properties/labels/items/properties/description" = {type = ["string", "null"]} +"/components/schemas/pull-request-stack/properties/base/properties/sha" = {type = ["string", "null"]} "/components/schemas/repository/properties/temp_clone_token" = {type = ["string", "null"]} "/components/schemas/minimal-repository/properties/temp_clone_token" = {type = ["string", "null"]} "/components/schemas/team-repository/properties/temp_clone_token" = {type = ["string", "null"]} diff --git a/pyproject.toml b/pyproject.toml index 4a8d878ee..84a49034a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -313,6 +313,12 @@ target_descriptions = ["ghec-2022-11-28", "ghec-2026-03-10"] "null", ] } +# https://github.com/yanyongyu/githubkit/issues/326 +"/components/schemas/pull-request-stack/properties/base/properties/sha" = { type = [ + "string", + "null", +] } + # https://github.com/github/rest-api-description/issues/621 "/components/schemas/repository/properties/temp_clone_token" = { type = [ "string", @@ -580,10 +586,22 @@ target_descriptions = ["ghec-2022-11-28", "ghec-2026-03-10"] ] } # webhook label archived_by user should be null or object -"/components/schemas/webhooks_label/properties/archived_by" = { type = ["null", "object"] } -"/components/schemas/webhooks_label_unarchived/allOf/1/properties/archived_by" = { type = ["null", "object"] } -"/components/schemas/webhook-issues-labeled/properties/issue/properties/labels/items/properties/archived_by" = { type = ["null", "object"] } -"/components/schemas/webhook-pull-request-labeled/properties/pull_request/properties/labels/items/properties/archived_by" = { type = ["null", "object"] } +"/components/schemas/webhooks_label/properties/archived_by" = { type = [ + "null", + "object", +] } +"/components/schemas/webhooks_label_unarchived/allOf/1/properties/archived_by" = { type = [ + "null", + "object", +] } +"/components/schemas/webhook-issues-labeled/properties/issue/properties/labels/items/properties/archived_by" = { type = [ + "null", + "object", +] } +"/components/schemas/webhook-pull-request-labeled/properties/pull_request/properties/labels/items/properties/archived_by" = { type = [ + "null", + "object", +] } # webhook deployment protection rule action is required "/components/schemas/webhook-deployment-protection-rule-requested" = { required = [