Skip to content

Commit 3e866e0

Browse files
committed
ci: add mypy type checking to CI workflow
- Add mypy step to GitHub Actions workflow - Fix type errors in commits.py and pull_requests.py (add isinstance check when assigning API response to dict variable)
1 parent 239cb77 commit 3e866e0

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
run: |
3232
ruff check src/github_analyzer/
3333
34+
- name: Run type checker
35+
run: |
36+
mypy src/github_analyzer/
37+
3438
- name: Run tests
3539
run: |
3640
pytest tests/ -v --tb=short

src/github_analyzer/analyzers/commits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def fetch_and_analyze(
5959
if sha:
6060
detail_endpoint = f"/repos/{repo.full_name}/commits/{sha}"
6161
detail = self._client.get(detail_endpoint)
62-
if detail:
62+
if detail and isinstance(detail, dict):
6363
raw = detail
6464

6565
commit = Commit.from_api_response(raw, repo.full_name)

src/github_analyzer/analyzers/pull_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def fetch_and_analyze(
7777
if number:
7878
detail_endpoint = f"/repos/{repo.full_name}/pulls/{number}"
7979
detail = self._client.get(detail_endpoint)
80-
if detail:
80+
if detail and isinstance(detail, dict):
8181
raw = detail
8282

8383
pr = PullRequest.from_api_response(raw, repo.full_name)

0 commit comments

Comments
 (0)