matchWorkflowRunRule function
The FIRST rule in rules that matches, or null when none does.
Declaration order is authoritative — a seat that declares two overlapping rules gets the earlier one's priority, plan and approval posture, and never two beads for one run. This is the ONE selector: the poll leg uses it to decide whether a run is worth a jobs request, and the intake projection uses it again to recover the rule that admitted the observation.
Implementation
WorkflowRunIntakeRule? matchWorkflowRunRule(
Iterable<WorkflowRunIntakeRule> rules, {
required String workflowPath,
required String event,
required String headBranch,
required String conclusion,
required String defaultBranch,
}) {
for (final rule in rules) {
if (rule.matches(
workflowPath: workflowPath,
event: event,
headBranch: headBranch,
conclusion: conclusion,
defaultBranch: defaultBranch,
)) {
return rule;
}
}
return null;
}