diff --git a/code/app.py b/code/app.py index ae9fe65..f3e0af9 100644 --- a/code/app.py +++ b/code/app.py @@ -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'