chore: fix type checking and CI workflow (#2)

This commit is contained in:
2026-02-17 23:58:33 +02:00
committed by GitHub
parent 36f25aaff4
commit 07ab166750
6 changed files with 12 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ jobs:
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0 - uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
- name: Install dependencies - name: Install dependencies
run: uv sync run: uv sync --extra dev
- name: Run tests - name: Run tests
run: uv run -m pytest --cov run: uv run -m pytest --cov
@@ -24,7 +24,7 @@ jobs:
run: uvx ruff check . run: uvx ruff check .
- name: Type check - name: Type check
run: uvx mypy . run: uv run mypy .
audit: audit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -35,10 +35,8 @@ jobs:
- uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0 - uses: astral-sh/setup-uv@3259c6206f993105e3a61b142c2d97bf4b9ef83d # v7.1.0
- name: Install - name: Install dependencies
run: | run: uv sync
uv sync
uv pip install -e .
- name: Audit workflows - name: Audit workflows
run: uv run ghaw-auditor scan --repo . --output audit-results run: uv run ghaw-auditor scan --repo . --output audit-results

View File

@@ -7,7 +7,7 @@ import logging
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
import diskcache import diskcache # type: ignore[import-untyped]
from platformdirs import user_cache_dir from platformdirs import user_cache_dir
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -70,7 +70,7 @@ class GitHubClient:
try: try:
response = self.client.get(url) response = self.client.get(url)
response.raise_for_status() response.raise_for_status()
sha = response.json()["sha"] sha: str = response.json()["sha"]
logger.debug(f"Resolved {owner}/{repo}@{ref} -> {sha}") logger.debug(f"Resolved {owner}/{repo}@{ref} -> {sha}")
return sha return sha
except httpx.HTTPStatusError as e: except httpx.HTTPStatusError as e:

View File

@@ -3,13 +3,13 @@
from __future__ import annotations from __future__ import annotations
from datetime import datetime from datetime import datetime
from enum import Enum from enum import StrEnum
from typing import Any from typing import Any
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
class ActionType(str, Enum): class ActionType(StrEnum):
"""Type of action reference.""" """Type of action reference."""
LOCAL = "local" LOCAL = "local"
@@ -72,7 +72,7 @@ class ActionManifest(BaseModel):
is_javascript: bool = False is_javascript: bool = False
class PermissionLevel(str, Enum): class PermissionLevel(StrEnum):
"""Permission level.""" """Permission level."""
NONE = "none" NONE = "none"
@@ -134,7 +134,7 @@ class JobMeta(BaseModel):
name: str name: str
runs_on: str | list[str] runs_on: str | list[str]
needs: list[str] = Field(default_factory=list) needs: list[str] = Field(default_factory=list)
if_condition: str | None = Field(None, alias="if") if_condition: str | None = Field(default=None, alias="if")
permissions: Permissions | None = None permissions: Permissions | None = None
environment: str | dict[str, Any] | None = None environment: str | dict[str, Any] | None = None
concurrency: str | dict[str, Any] | None = None concurrency: str | dict[str, Any] | None = None

View File

@@ -157,7 +157,7 @@ class Parser:
actions_used: list[ActionRef] = [] actions_used: list[ActionRef] = []
secrets_used: set[str] = set() secrets_used: set[str] = set()
if is_reusable_call: if is_reusable_call and isinstance(uses, str):
# Parse reusable workflow reference # Parse reusable workflow reference
workflow_ref = self._parse_reusable_workflow_ref(uses, path) workflow_ref = self._parse_reusable_workflow_ref(uses, path)
actions_used.append(workflow_ref) actions_used.append(workflow_ref)

View File

@@ -35,7 +35,7 @@ class Scanner:
def find_workflows(self) -> list[Path]: def find_workflows(self) -> list[Path]:
"""Find all workflow files.""" """Find all workflow files."""
workflows = [] workflows: list[Path] = []
workflow_dir = self.repo_path / ".github" / "workflows" workflow_dir = self.repo_path / ".github" / "workflows"
if not workflow_dir.exists(): if not workflow_dir.exists():