|
9 | 9 |
|
10 | 10 | from __future__ import annotations |
11 | 11 |
|
12 | | -from typing import Literal |
| 12 | +import datetime as _dt |
| 13 | +from typing import Literal, Union |
13 | 14 |
|
14 | 15 | from pydantic import Field |
15 | 16 |
|
16 | 17 | from githubkit.compat import GitHubModel, model_rebuild |
| 18 | +from githubkit.typing import Missing |
| 19 | +from githubkit.utils import UNSET |
17 | 20 |
|
| 21 | +from .group_0110 import RepositoryRulesetBypassActor |
| 22 | +from .group_0115 import RepositoryRulesetConditions |
| 23 | +from .group_0129 import ( |
| 24 | + RepositoryRuleCreation, |
| 25 | + RepositoryRuleDeletion, |
| 26 | + RepositoryRuleNonFastForward, |
| 27 | + RepositoryRuleRequiredSignatures, |
| 28 | +) |
| 29 | +from .group_0130 import RepositoryRuleUpdate |
| 30 | +from .group_0132 import RepositoryRuleRequiredLinearHistory |
| 31 | +from .group_0133 import RepositoryRuleRequiredDeployments |
| 32 | +from .group_0135 import RepositoryRulePullRequest |
| 33 | +from .group_0137 import RepositoryRuleRequiredStatusChecks |
| 34 | +from .group_0139 import RepositoryRuleCommitMessagePattern |
| 35 | +from .group_0141 import RepositoryRuleCommitAuthorEmailPattern |
| 36 | +from .group_0143 import RepositoryRuleCommitterEmailPattern |
| 37 | +from .group_0145 import RepositoryRuleBranchNamePattern |
| 38 | +from .group_0147 import RepositoryRuleTagNamePattern |
| 39 | +from .group_0149 import RepositoryRuleFilePathRestriction |
| 40 | +from .group_0151 import RepositoryRuleMaxFilePathLength |
| 41 | +from .group_0153 import RepositoryRuleFileExtensionRestriction |
| 42 | +from .group_0155 import RepositoryRuleMaxFileSize |
| 43 | +from .group_0158 import RepositoryRuleWorkflows |
| 44 | +from .group_0160 import RepositoryRuleCodeScanning |
| 45 | +from .group_0162 import RepositoryRuleCopilotCodeReview |
| 46 | +from .group_0166 import OrgRulesetConditionsOneof0 |
| 47 | +from .group_0167 import OrgRulesetConditionsOneof1 |
| 48 | +from .group_0168 import OrgRulesetConditionsOneof2 |
| 49 | +from .group_0169 import RepositoryRuleMergeQueue |
18 | 50 |
|
19 | | -class RepositoryRuleParamsCopilotCodeReviewAnalysisTool(GitHubModel): |
20 | | - """CopilotCodeReviewAnalysisTool |
21 | 51 |
|
22 | | - A tool that must provide code review results for this rule to pass. |
| 52 | +class RepositoryRuleset(GitHubModel): |
| 53 | + """Repository ruleset |
| 54 | +
|
| 55 | + A set of rules to apply when specified conditions are met. |
23 | 56 | """ |
24 | 57 |
|
25 | | - name: Literal["CodeQL", "ESLint", "PMD"] = Field( |
26 | | - description="The name of a code review analysis tool" |
| 58 | + id: int = Field(description="The ID of the ruleset") |
| 59 | + name: str = Field(description="The name of the ruleset") |
| 60 | + target: Missing[Literal["branch", "tag", "push", "repository"]] = Field( |
| 61 | + default=UNSET, description="The target of the ruleset" |
| 62 | + ) |
| 63 | + source_type: Missing[Literal["Repository", "Organization", "Enterprise"]] = Field( |
| 64 | + default=UNSET, description="The type of the source of the ruleset" |
| 65 | + ) |
| 66 | + source: str = Field(description="The name of the source") |
| 67 | + enforcement: Literal["disabled", "active", "evaluate"] = Field( |
| 68 | + description="The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page. `evaluate` is not available for the `repository` target." |
| 69 | + ) |
| 70 | + bypass_actors: Missing[list[RepositoryRulesetBypassActor]] = Field( |
| 71 | + default=UNSET, |
| 72 | + description="The actors that can bypass the rules in this ruleset", |
| 73 | + ) |
| 74 | + current_user_can_bypass: Missing[ |
| 75 | + Literal["always", "pull_requests_only", "never", "exempt"] |
| 76 | + ] = Field( |
| 77 | + default=UNSET, |
| 78 | + description="The bypass type of the user making the API request for this ruleset. This field is only returned when\nquerying the repository-level endpoint.", |
| 79 | + ) |
| 80 | + node_id: Missing[str] = Field(default=UNSET) |
| 81 | + links: Missing[RepositoryRulesetPropLinks] = Field(default=UNSET, alias="_links") |
| 82 | + conditions: Missing[ |
| 83 | + Union[ |
| 84 | + RepositoryRulesetConditions, |
| 85 | + OrgRulesetConditionsOneof0, |
| 86 | + OrgRulesetConditionsOneof1, |
| 87 | + OrgRulesetConditionsOneof2, |
| 88 | + None, |
| 89 | + ] |
| 90 | + ] = Field(default=UNSET) |
| 91 | + rules: Missing[ |
| 92 | + list[ |
| 93 | + Union[ |
| 94 | + RepositoryRuleCreation, |
| 95 | + RepositoryRuleUpdate, |
| 96 | + RepositoryRuleDeletion, |
| 97 | + RepositoryRuleRequiredLinearHistory, |
| 98 | + RepositoryRuleMergeQueue, |
| 99 | + RepositoryRuleRequiredDeployments, |
| 100 | + RepositoryRuleRequiredSignatures, |
| 101 | + RepositoryRulePullRequest, |
| 102 | + RepositoryRuleRequiredStatusChecks, |
| 103 | + RepositoryRuleNonFastForward, |
| 104 | + RepositoryRuleCommitMessagePattern, |
| 105 | + RepositoryRuleCommitAuthorEmailPattern, |
| 106 | + RepositoryRuleCommitterEmailPattern, |
| 107 | + RepositoryRuleBranchNamePattern, |
| 108 | + RepositoryRuleTagNamePattern, |
| 109 | + RepositoryRuleFilePathRestriction, |
| 110 | + RepositoryRuleMaxFilePathLength, |
| 111 | + RepositoryRuleFileExtensionRestriction, |
| 112 | + RepositoryRuleMaxFileSize, |
| 113 | + RepositoryRuleWorkflows, |
| 114 | + RepositoryRuleCodeScanning, |
| 115 | + RepositoryRuleCopilotCodeReview, |
| 116 | + ] |
| 117 | + ] |
| 118 | + ] = Field(default=UNSET) |
| 119 | + created_at: Missing[_dt.datetime] = Field(default=UNSET) |
| 120 | + updated_at: Missing[_dt.datetime] = Field(default=UNSET) |
| 121 | + |
| 122 | + |
| 123 | +class RepositoryRulesetPropLinks(GitHubModel): |
| 124 | + """RepositoryRulesetPropLinks""" |
| 125 | + |
| 126 | + self_: Missing[RepositoryRulesetPropLinksPropSelf] = Field( |
| 127 | + default=UNSET, alias="self" |
| 128 | + ) |
| 129 | + html: Missing[Union[RepositoryRulesetPropLinksPropHtml, None]] = Field( |
| 130 | + default=UNSET |
27 | 131 | ) |
28 | 132 |
|
29 | 133 |
|
30 | | -model_rebuild(RepositoryRuleParamsCopilotCodeReviewAnalysisTool) |
| 134 | +class RepositoryRulesetPropLinksPropSelf(GitHubModel): |
| 135 | + """RepositoryRulesetPropLinksPropSelf""" |
| 136 | + |
| 137 | + href: Missing[str] = Field(default=UNSET, description="The URL of the ruleset") |
| 138 | + |
| 139 | + |
| 140 | +class RepositoryRulesetPropLinksPropHtml(GitHubModel): |
| 141 | + """RepositoryRulesetPropLinksPropHtml""" |
| 142 | + |
| 143 | + href: Missing[str] = Field(default=UNSET, description="The html URL of the ruleset") |
| 144 | + |
| 145 | + |
| 146 | +model_rebuild(RepositoryRuleset) |
| 147 | +model_rebuild(RepositoryRulesetPropLinks) |
| 148 | +model_rebuild(RepositoryRulesetPropLinksPropSelf) |
| 149 | +model_rebuild(RepositoryRulesetPropLinksPropHtml) |
31 | 150 |
|
32 | | -__all__ = ("RepositoryRuleParamsCopilotCodeReviewAnalysisTool",) |
| 151 | +__all__ = ( |
| 152 | + "RepositoryRuleset", |
| 153 | + "RepositoryRulesetPropLinks", |
| 154 | + "RepositoryRulesetPropLinksPropHtml", |
| 155 | + "RepositoryRulesetPropLinksPropSelf", |
| 156 | +) |
0 commit comments