added checking for presence of runner script

This commit is contained in:
brb
2023-07-06 13:10:13 +02:00
parent 3a73c9cf6e
commit 9fffa861e7
+10 -1
View File
@@ -27,7 +27,7 @@ async def test(request: Request):
@app.post('/event')
def handle_event(request: GiteaRequest):
""" Handle event from webhook. """
# stop early if allowed
# stop early if asked
commit_msg = request.head_commit['message']
if commit_msg.lower().startswith('[skip ci]'):
raise HTTPException(
@@ -39,6 +39,15 @@ def handle_event(request: GiteaRequest):
logging.info('cloning repository: {repo_url}')
local_repo_dir = clone_repository(repo_url)
logging.info(f'local_repo_dir: {local_repo_dir}')
# locate runner script
runner_script_path = local_repo_dir / 'runner_script.yml'
if not runner_script_path.exists():
raise HTTPException(
status_code=200,
detail='no "runner_script.yml" in repository root'
)
# send response
raise HTTPException(
status_code=202,
detail='received task'