From 2298ee015fcf61c75b4d8dc9015ca13272d7d944 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Thu, 1 Apr 2021 19:43:23 +0200 Subject: [PATCH] fix: don't fail to retrieve branch protection if branch is gone Fixes MERGIFY-ENGINE-255 --- mergify_engine/actions/merge_base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mergify_engine/actions/merge_base.py b/mergify_engine/actions/merge_base.py index 78d37f11c1..ef3ca2e5ed 100644 --- a/mergify_engine/actions/merge_base.py +++ b/mergify_engine/actions/merge_base.py @@ -142,7 +142,10 @@ async def _get_queue_summary( async def _get_branch_protection_conditions( ctxt: context.Context, ) -> typing.List[filter.Filter]: - branch = await ctxt.repository.get_branch(ctxt.pull["base"]["ref"]) + try: + branch = await ctxt.repository.get_branch(ctxt.pull["base"]["ref"]) + except http.HTTPNotFound: + return [] if not branch["protection"]["enabled"]: return [] return [