Skip to content

Commit ddd04eb

Browse files
committed
Replace "Any" field types with fixed types for Workflow model fields
1 parent 36ed53d commit ddd04eb

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

src/openhound_github/models/workflow.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class WorkflowStepDefinition(BaseModel):
5151
name: str | None = None
5252
uses: str | None = None
5353
run: str | None = None
54-
with_: dict[str, Any] = Field(default_factory=dict, alias="with")
55-
env: dict[str, Any] = Field(default_factory=dict)
54+
with_: dict[str, str] = Field(default_factory=dict, alias="with")
55+
env: dict[str, str] = Field(default_factory=dict)
5656

5757
@field_validator("with_", "env", mode="before")
5858
@classmethod
@@ -79,17 +79,24 @@ def type(self) -> str:
7979
return "unknown"
8080

8181

82+
class Container(BaseModel):
83+
image: str
84+
credentials: dict[str, str] | None = None
85+
env: dict[str, str] | None = None
86+
ports: list[int] | None = None
87+
88+
8289
class WorkflowJobDefinition(BaseModel):
8390
model_config = ConfigDict(extra="allow", populate_by_name=True)
8491

85-
runs_on: Any = Field(default=None, alias="runs-on")
86-
needs: Any = None
87-
environment: Any = None
88-
permissions: Any = None
92+
runs_on: str | list[str] | dict[str, str] = Field(default=None, alias="runs-on")
93+
needs: str | list[str] = None
94+
environment: str | dict[str, str] = None
95+
permissions: str | dict[str, str] = None
8996
uses: str | None = None
90-
container: Any = None
91-
env: dict[str, Any] = Field(default_factory=dict)
92-
secrets: dict[str, Any] | str | None = None
97+
container: Container = None
98+
env: dict[str, str] = Field(default_factory=dict)
99+
secrets: dict[str, str] | str | None = None
93100
steps: list[WorkflowStepDefinition] = Field(default_factory=list)
94101

95102
@field_validator("env", mode="before")
@@ -143,7 +150,7 @@ def container_value(self) -> str | None:
143150
class WorkflowDocument(BaseModel):
144151
model_config = ConfigDict(extra="allow")
145152

146-
permissions: Any = None
153+
permissions: str | dict[str, str] = None
147154
jobs: dict[str, WorkflowJobDefinition] = Field(default_factory=dict)
148155

149156
@field_validator("jobs", mode="before")

0 commit comments

Comments
 (0)