@@ -116,7 +116,7 @@ def get_workflow_status(self, sha: str, branch: str = None) -> Dict:
116116 "workflows" : list (workflows .values ()),
117117 }
118118
119- def are_all_checks_passed (self , sha : str , branch : str = None ) -> Tuple [bool , Dict ]:
119+ def are_all_checks_passed (self , sha : str , branch : str = None , exclude_workflows : List [ str ] = None ) -> Tuple [bool , Dict ]:
120120 """
121121 Check if all checks and workflows have passed for a commit and branch.
122122
@@ -128,10 +128,13 @@ def are_all_checks_passed(self, sha: str, branch: str = None) -> Tuple[bool, Dic
128128 Args:
129129 sha: Commit SHA
130130 branch: Optional branch name to also check workflows for the branch
131+ exclude_workflows: List of workflow names to exclude from the check
131132
132133 Returns:
133134 Tuple of (all_passed: bool, details: Dict)
134135 """
136+ if exclude_workflows is None :
137+ exclude_workflows = []
135138 import requests
136139
137140 # Get checks for the SHA
@@ -170,24 +173,32 @@ def are_all_checks_passed(self, sha: str, branch: str = None) -> Tuple[bool, Dic
170173 combined_status == "success"
171174 )
172175
173- # Check if all workflows passed
176+ # Check if all workflows passed (excluding specified workflows)
174177 workflows = workflow_status .get ("workflows" , [])
178+ # Filter out excluded workflows
179+ relevant_workflows = [
180+ w for w in workflows
181+ if w .get ("name" ) not in exclude_workflows
182+ ]
183+
175184 all_workflows_passed = (
176- len (workflows ) > 0 and
185+ len (relevant_workflows ) > 0 and
177186 all (w .get ("status" ) == "completed" and w .get ("conclusion" ) == "success"
178- for w in workflows )
187+ for w in relevant_workflows )
179188 )
180189
181- # Check for running workflows
190+ # Check for running workflows (excluding excluded ones)
182191 running_workflows = [
183192 w for w in workflows
184- if w .get ("status" ) in ["in_progress" , "queued" , "waiting" ]
193+ if w .get ("name" ) not in exclude_workflows
194+ and w .get ("status" ) in ["in_progress" , "queued" , "waiting" ]
185195 ]
186196
187- # Check for failed workflows
197+ # Check for failed workflows (excluding excluded ones)
188198 failed_workflows = [
189199 w for w in workflows
190- if w .get ("status" ) == "completed" and w .get ("conclusion" ) == "failure"
200+ if w .get ("name" ) not in exclude_workflows
201+ and w .get ("status" ) == "completed" and w .get ("conclusion" ) == "failure"
191202 ]
192203
193204 # Check for pending checks
@@ -221,8 +232,9 @@ def are_all_checks_passed(self, sha: str, branch: str = None) -> Tuple[bool, Dic
221232 "pending_checks" : pending_checks ,
222233 "failed_checks" : failed_checks ,
223234 "total_checks" : len (check_runs ),
224- "total_workflows" : len (workflows ),
235+ "total_workflows" : len (relevant_workflows ),
225236 "combined_status" : combined_status ,
237+ "excluded_workflows" : exclude_workflows ,
226238 }
227239
228240 return (truly_all_passed , details )
0 commit comments