added checking for presence of runner script
This commit is contained in:
+10
-1
@@ -27,7 +27,7 @@ async def test(request: Request):
|
|||||||
@app.post('/event')
|
@app.post('/event')
|
||||||
def handle_event(request: GiteaRequest):
|
def handle_event(request: GiteaRequest):
|
||||||
""" Handle event from webhook. """
|
""" Handle event from webhook. """
|
||||||
# stop early if allowed
|
# stop early if asked
|
||||||
commit_msg = request.head_commit['message']
|
commit_msg = request.head_commit['message']
|
||||||
if commit_msg.lower().startswith('[skip ci]'):
|
if commit_msg.lower().startswith('[skip ci]'):
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@@ -39,6 +39,15 @@ def handle_event(request: GiteaRequest):
|
|||||||
logging.info('cloning repository: {repo_url}')
|
logging.info('cloning repository: {repo_url}')
|
||||||
local_repo_dir = clone_repository(repo_url)
|
local_repo_dir = clone_repository(repo_url)
|
||||||
logging.info(f'local_repo_dir: {local_repo_dir}')
|
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(
|
raise HTTPException(
|
||||||
status_code=202,
|
status_code=202,
|
||||||
detail='received task'
|
detail='received task'
|
||||||
|
|||||||
Reference in New Issue
Block a user