Change invalid branch to 202. Fix json check for ref

This commit is contained in:
jimmy 2021-08-01 01:42:43 +00:00
parent f6befc4ad2
commit 10d73d8fc9
1 changed files with 2 additions and 2 deletions

View File

@ -9,9 +9,9 @@ load_dotenv()
async def check_ref(request: Request):
json = await request.json()
if json["ref"] and json["ref"] == f"refs/heads/{os.environ.get('BRANCH')}":
if "ref" in json and json["ref"] == f"refs/heads/{os.environ.get('BRANCH')}":
return
raise HTTPException(status_code=403, detail="Invalid branch")
raise HTTPException(status_code=202, detail="Invalid branch")
async def auth_hook(request: Request):
try: