Compare commits
2
Commits
9fffa861e7
...
ed05a8eca5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed05a8eca5 | ||
|
|
02ec54fd16 |
+18
-4
@@ -1,5 +1,6 @@
|
||||
import uvicorn
|
||||
from fastapi import FastAPI, Request, HTTPException
|
||||
from fastapi.responses import HTMLResponse
|
||||
from dotenv import load_dotenv
|
||||
import logging
|
||||
from typing import List
|
||||
@@ -11,9 +12,20 @@ from gitea_request import GiteaRequest
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@app.get('/')
|
||||
@app.get('/', response_class=HTMLResponse)
|
||||
async def root():
|
||||
return '<h1>Welcome to Gitea Runsner</h1>'
|
||||
content_str = """
|
||||
<html>
|
||||
<head>
|
||||
<title>Gitea Runner</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to Gitea Runner</h1>
|
||||
<p>see /docs for more information</p>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
return HTMLResponse(content=content_str, status_code=200)
|
||||
|
||||
@app.post('/test')
|
||||
async def test(request: Request):
|
||||
@@ -44,9 +56,11 @@ def handle_event(request: GiteaRequest):
|
||||
if not runner_script_path.exists():
|
||||
raise HTTPException(
|
||||
status_code=200,
|
||||
detail='no "runner_script.yml" in repository root'
|
||||
detail="no runner_script.yml in repository root"
|
||||
)
|
||||
|
||||
# load runner commands
|
||||
|
||||
|
||||
# send response
|
||||
raise HTTPException(
|
||||
status_code=202,
|
||||
|
||||
Reference in New Issue
Block a user