Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ jobs:
version: 0.7
- name: Install dependencies
run: uv sync
- name: Type check
run: uv run ty check
- name: Run tests
run: PYTHON_ENV=test uv run pytest
20 changes: 13 additions & 7 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import json
import logging
from typing import cast

from automa.bot import AsyncAutoma
from automa.bot import AsyncAutoma, CodeProposeParams
from automa.bot.webhook import verify_webhook
from fastapi import FastAPI, Request, Response

Expand All @@ -28,7 +29,9 @@ async def automa_hook(request: Request):
return Response(status_code=204)

# Verify request
if not verify_webhook(env().automa_webhook_secret, signature, payload):
if signature is None or not verify_webhook(
env().automa_webhook_secret, signature, payload
):
logging.warning(
"Invalid signature",
)
Expand All @@ -55,12 +58,15 @@ async def automa_hook(request: Request):

# Propose code
await automa.code.propose(
{
**body["data"],
"proposal": {
"title": "We changed your code",
cast(
CodeProposeParams,
{
**body["data"],
"proposal": {
"title": "We changed your code",
},
},
}
)
)
finally:
# Clean up
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies = [
]

[dependency-groups]
dev = ["httpx~=0.28.1", "pytest>=8.3.5,<9", "ruff~=0.11.2"]
dev = ["httpx~=0.28.1", "pytest>=8.3.5,<9", "ruff~=0.11.2", "ty~=0.0.8"]

[tool.pytest.ini_options]
pythonpath = "."
Expand Down
Loading