You could split the logic for selecting determining if a build is necessary from grouping the branches.
Totally untested:

```ruby
def should_build?(pull_request)
  whitelist = ConfigFile.whitelist_branches
  pull_request[:is_test_required] && ( whitelist.empty? || whitelist.include? branch )
end

def PullRequestsData.pull_requests_that_require_testing
  read.values.select { |pr| should_build? pr }
end
```