Skip to content

Commit cead9fc

Browse files
authored
🐛 Fix: Allow Organization name and blog to be nullable (#49)
1 parent d01733b commit cead9fc

File tree

4 files changed

+140
-20
lines changed

4 files changed

+140
-20
lines changed

githubkit/rest/actions.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5419,6 +5419,50 @@ async def async_review_custom_gates_for_run(
54195419
headers=exclude_unset(headers),
54205420
)
54215421

5422+
def force_cancel_workflow_run(
5423+
self,
5424+
owner: str,
5425+
repo: str,
5426+
run_id: int,
5427+
*,
5428+
headers: Optional[Dict[str, str]] = None,
5429+
) -> "Response[EmptyObject]":
5430+
url = f"/repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel"
5431+
5432+
headers = {"X-GitHub-Api-Version": self._REST_API_VERSION, **(headers or {})}
5433+
5434+
return self._github.request(
5435+
"POST",
5436+
url,
5437+
headers=exclude_unset(headers),
5438+
response_model=EmptyObject,
5439+
error_models={
5440+
"409": BasicError,
5441+
},
5442+
)
5443+
5444+
async def async_force_cancel_workflow_run(
5445+
self,
5446+
owner: str,
5447+
repo: str,
5448+
run_id: int,
5449+
*,
5450+
headers: Optional[Dict[str, str]] = None,
5451+
) -> "Response[EmptyObject]":
5452+
url = f"/repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel"
5453+
5454+
headers = {"X-GitHub-Api-Version": self._REST_API_VERSION, **(headers or {})}
5455+
5456+
return await self._github.arequest(
5457+
"POST",
5458+
url,
5459+
headers=exclude_unset(headers),
5460+
response_model=EmptyObject,
5461+
error_models={
5462+
"409": BasicError,
5463+
},
5464+
)
5465+
54225466
def list_jobs_for_workflow_run(
54235467
self,
54245468
owner: str,

githubkit/rest/models.py

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,9 +2932,9 @@ class OrganizationFull(GitHubRestModel):
29322932
public_members_url: str = Field(default=...)
29332933
avatar_url: str = Field(default=...)
29342934
description: Union[str, None] = Field(default=...)
2935-
name: Missing[str] = Field(default=UNSET)
2935+
name: Missing[Union[str, None]] = Field(default=UNSET)
29362936
company: Missing[Union[str, None]] = Field(default=UNSET)
2937-
blog: Missing[str] = Field(default=UNSET)
2937+
blog: Missing[Union[str, None]] = Field(default=UNSET)
29382938
location: Missing[Union[str, None]] = Field(default=UNSET)
29392939
email: Missing[Union[str, None]] = Field(default=UNSET)
29402940
twitter_username: Missing[Union[str, None]] = Field(default=UNSET)
@@ -4459,7 +4459,7 @@ class RepositoryRuleDeletion(GitHubRestModel):
44594459
class RepositoryRuleRequiredLinearHistory(GitHubRestModel):
44604460
"""required_linear_history
44614461

4462-
Prevent merge commits from being pushed to matching branches.
4462+
Prevent merge commits from being pushed to matching refs.
44634463
"""
44644464

44654465
type: Literal["required_linear_history"] = Field(default=...)
@@ -4468,8 +4468,8 @@ class RepositoryRuleRequiredLinearHistory(GitHubRestModel):
44684468
class RepositoryRuleRequiredDeployments(GitHubRestModel):
44694469
"""required_deployments
44704470

4471-
Choose which environments must be successfully deployed to before branches can
4472-
be merged into a branch that matches this rule.
4471+
Choose which environments must be successfully deployed to before refs can be
4472+
merged into a branch that matches this rule.
44734473
"""
44744474

44754475
type: Literal["required_deployments"] = Field(default=...)
@@ -4490,7 +4490,7 @@ class RepositoryRuleRequiredDeploymentsPropParameters(GitHubRestModel):
44904490
class RepositoryRuleRequiredSignatures(GitHubRestModel):
44914491
"""required_signatures
44924492

4493-
Commits pushed to matching branches must have verified signatures.
4493+
Commits pushed to matching refs must have verified signatures.
44944494
"""
44954495

44964496
type: Literal["required_signatures"] = Field(default=...)
@@ -4554,7 +4554,7 @@ class RepositoryRuleRequiredStatusChecks(GitHubRestModel):
45544554

45554555
Choose which status checks must pass before branches can be merged into a branch
45564556
that matches this rule. When enabled, commits must first be pushed to another
4557-
branch, then merged or pushed directly to a branch that matches this rule after
4557+
branch, then merged or pushed directly to a ref that matches this rule after
45584558
status checks have passed.
45594559
"""
45604560

@@ -4579,7 +4579,7 @@ class RepositoryRuleRequiredStatusChecksPropParameters(GitHubRestModel):
45794579
class RepositoryRuleNonFastForward(GitHubRestModel):
45804580
"""non_fast_forward
45814581

4582-
Prevent users with push access from force pushing to branches.
4582+
Prevent users with push access from force pushing to refs.
45834583
"""
45844584

45854585
type: Literal["non_fast_forward"] = Field(default=...)
@@ -5147,9 +5147,9 @@ class TeamOrganization(GitHubRestModel):
51475147
public_members_url: str = Field(default=...)
51485148
avatar_url: str = Field(default=...)
51495149
description: Union[str, None] = Field(default=...)
5150-
name: Missing[str] = Field(default=UNSET)
5150+
name: Missing[Union[str, None]] = Field(default=UNSET)
51515151
company: Missing[Union[str, None]] = Field(default=UNSET)
5152-
blog: Missing[str] = Field(default=UNSET)
5152+
blog: Missing[Union[str, None]] = Field(default=UNSET)
51535153
location: Missing[Union[str, None]] = Field(default=UNSET)
51545154
email: Missing[Union[str, None]] = Field(default=UNSET)
51555155
twitter_username: Missing[Union[str, None]] = Field(default=UNSET)
@@ -9002,6 +9002,10 @@ class EnvironmentPropProtectionRulesItemsAnyof1(GitHubRestModel):
90029002

90039003
id: int = Field(default=...)
90049004
node_id: str = Field(default=...)
9005+
prevent_self_review: Missing[bool] = Field(
9006+
description="Whether deployments to this environment can be approved by the user who created the deployment.",
9007+
default=UNSET,
9008+
)
90059009
type: str = Field(default=...)
90069010
reviewers: Missing[
90079011
List[EnvironmentPropProtectionRulesItemsAnyof1PropReviewersItems]
@@ -13302,6 +13306,35 @@ class KeySimple(GitHubRestModel):
1330213306
key: str = Field(default=...)
1330313307

1330413308

13309+
class EnterpriseWebhooks(GitHubRestModel):
13310+
"""Enterprise
13311+
13312+
An enterprise on GitHub. Webhook payloads contain the `enterprise` property when
13313+
the webhook is configured
13314+
on an enterprise account or an organization that's part of an enterprise
13315+
account. For more information,
13316+
see "[About enterprise accounts](https://docs.github.com/admin/overview/about-
13317+
enterprise-accounts)."
13318+
"""
13319+
13320+
description: Missing[Union[str, None]] = Field(
13321+
description="A short description of the enterprise.", default=UNSET
13322+
)
13323+
html_url: str = Field(default=...)
13324+
website_url: Missing[Union[str, None]] = Field(
13325+
description="The enterprise's website URL.", default=UNSET
13326+
)
13327+
id: int = Field(description="Unique identifier of the enterprise", default=...)
13328+
node_id: str = Field(default=...)
13329+
name: str = Field(description="The name of the enterprise.", default=...)
13330+
slug: str = Field(
13331+
description="The slug url identifier for the enterprise.", default=...
13332+
)
13333+
created_at: Union[datetime, None] = Field(default=...)
13334+
updated_at: Union[datetime, None] = Field(default=...)
13335+
avatar_url: str = Field(default=...)
13336+
13337+
1330513338
class SimpleInstallation(GitHubRestModel):
1330613339
"""Simple Installation
1330713340

@@ -20793,6 +20826,7 @@ class UserSshSigningKeysPostBody(GitHubRestModel):
2079320826
Hovercard.update_forward_refs()
2079420827
HovercardPropContextsItems.update_forward_refs()
2079520828
KeySimple.update_forward_refs()
20829+
EnterpriseWebhooks.update_forward_refs()
2079620830
SimpleInstallation.update_forward_refs()
2079720831
OrganizationSimpleWebhooks.update_forward_refs()
2079820832
RepositoryWebhooks.update_forward_refs()
@@ -21852,6 +21886,7 @@ class UserSshSigningKeysPostBody(GitHubRestModel):
2185221886
"Hovercard",
2185321887
"HovercardPropContextsItems",
2185421888
"KeySimple",
21889+
"EnterpriseWebhooks",
2185521890
"SimpleInstallation",
2185621891
"OrganizationSimpleWebhooks",
2185721892
"RepositoryWebhooks",

githubkit/rest/types.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,9 +2021,9 @@ class OrganizationFullType(TypedDict):
20212021
public_members_url: str
20222022
avatar_url: str
20232023
description: Union[str, None]
2024-
name: NotRequired[str]
2024+
name: NotRequired[Union[str, None]]
20252025
company: NotRequired[Union[str, None]]
2026-
blog: NotRequired[str]
2026+
blog: NotRequired[Union[str, None]]
20272027
location: NotRequired[Union[str, None]]
20282028
email: NotRequired[Union[str, None]]
20292029
twitter_username: NotRequired[Union[str, None]]
@@ -3027,7 +3027,7 @@ class RepositoryRuleDeletionType(TypedDict):
30273027
class RepositoryRuleRequiredLinearHistoryType(TypedDict):
30283028
"""required_linear_history
30293029
3030-
Prevent merge commits from being pushed to matching branches.
3030+
Prevent merge commits from being pushed to matching refs.
30313031
"""
30323032

30333033
type: Literal["required_linear_history"]
@@ -3036,8 +3036,8 @@ class RepositoryRuleRequiredLinearHistoryType(TypedDict):
30363036
class RepositoryRuleRequiredDeploymentsType(TypedDict):
30373037
"""required_deployments
30383038
3039-
Choose which environments must be successfully deployed to before branches can
3040-
be merged into a branch that matches this rule.
3039+
Choose which environments must be successfully deployed to before refs can be
3040+
merged into a branch that matches this rule.
30413041
"""
30423042

30433043
type: Literal["required_deployments"]
@@ -3053,7 +3053,7 @@ class RepositoryRuleRequiredDeploymentsPropParametersType(TypedDict):
30533053
class RepositoryRuleRequiredSignaturesType(TypedDict):
30543054
"""required_signatures
30553055
3056-
Commits pushed to matching branches must have verified signatures.
3056+
Commits pushed to matching refs must have verified signatures.
30573057
"""
30583058

30593059
type: Literal["required_signatures"]
@@ -3095,7 +3095,7 @@ class RepositoryRuleRequiredStatusChecksType(TypedDict):
30953095
30963096
Choose which status checks must pass before branches can be merged into a branch
30973097
that matches this rule. When enabled, commits must first be pushed to another
3098-
branch, then merged or pushed directly to a branch that matches this rule after
3098+
branch, then merged or pushed directly to a ref that matches this rule after
30993099
status checks have passed.
31003100
"""
31013101

@@ -3113,7 +3113,7 @@ class RepositoryRuleRequiredStatusChecksPropParametersType(TypedDict):
31133113
class RepositoryRuleNonFastForwardType(TypedDict):
31143114
"""non_fast_forward
31153115
3116-
Prevent users with push access from force pushing to branches.
3116+
Prevent users with push access from force pushing to refs.
31173117
"""
31183118

31193119
type: Literal["non_fast_forward"]
@@ -3485,9 +3485,9 @@ class TeamOrganizationType(TypedDict):
34853485
public_members_url: str
34863486
avatar_url: str
34873487
description: Union[str, None]
3488-
name: NotRequired[str]
3488+
name: NotRequired[Union[str, None]]
34893489
company: NotRequired[Union[str, None]]
3490-
blog: NotRequired[str]
3490+
blog: NotRequired[Union[str, None]]
34913491
location: NotRequired[Union[str, None]]
34923492
email: NotRequired[Union[str, None]]
34933493
twitter_username: NotRequired[Union[str, None]]
@@ -6368,6 +6368,7 @@ class EnvironmentPropProtectionRulesItemsAnyof1Type(TypedDict):
63686368

63696369
id: int
63706370
node_id: str
6371+
prevent_self_review: NotRequired[bool]
63716372
type: str
63726373
reviewers: NotRequired[
63736374
List[EnvironmentPropProtectionRulesItemsAnyof1PropReviewersItemsType]
@@ -9653,6 +9654,29 @@ class KeySimpleType(TypedDict):
96539654
key: str
96549655

96559656

9657+
class EnterpriseWebhooksType(TypedDict):
9658+
"""Enterprise
9659+
9660+
An enterprise on GitHub. Webhook payloads contain the `enterprise` property when
9661+
the webhook is configured
9662+
on an enterprise account or an organization that's part of an enterprise
9663+
account. For more information,
9664+
see "[About enterprise accounts](https://docs.github.com/admin/overview/about-
9665+
enterprise-accounts)."
9666+
"""
9667+
9668+
description: NotRequired[Union[str, None]]
9669+
html_url: str
9670+
website_url: NotRequired[Union[str, None]]
9671+
id: int
9672+
node_id: str
9673+
name: str
9674+
slug: str
9675+
created_at: Union[datetime, None]
9676+
updated_at: Union[datetime, None]
9677+
avatar_url: str
9678+
9679+
96569680
class SimpleInstallationType(TypedDict):
96579681
"""Simple Installation
96589682
@@ -14649,6 +14673,7 @@ class UserSshSigningKeysPostBodyType(TypedDict):
1464914673
"HovercardType",
1465014674
"HovercardPropContextsItemsType",
1465114675
"KeySimpleType",
14676+
"EnterpriseWebhooksType",
1465214677
"SimpleInstallationType",
1465314678
"OrganizationSimpleWebhooksType",
1465414679
"RepositoryWebhooksType",

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ output_dir = "githubkit/rest/"
191191
"string",
192192
"null",
193193
] }
194+
"/components/schemas/organization-full/properties/name" = { type = [
195+
"string",
196+
"null",
197+
] }
198+
"/components/schemas/organization-full/properties/blog" = { type = [
199+
"string",
200+
"null",
201+
] }
194202
"/components/schemas/team-organization/properties/company" = { type = [
195203
"string",
196204
"null",
@@ -203,6 +211,14 @@ output_dir = "githubkit/rest/"
203211
"string",
204212
"null",
205213
] }
214+
"/components/schemas/team-organization/properties/name" = { type = [
215+
"string",
216+
"null",
217+
] }
218+
"/components/schemas/team-organization/properties/blog" = { type = [
219+
"string",
220+
"null",
221+
] }
206222

207223
# copilot-seat-details/assignee is not valid
208224
"/components/schemas/copilot-seat-details/properties/assignee" = { enum = "<unset>", oneOf = [

0 commit comments

Comments
 (0)