FR: when first enabled, process all open PRs
What happened
Someone just asked why bulldozer wasn't working on a PR and all the configuration looked right (bot enabled, correctly configured etc). Turns out it just hadn't delivered any webhooks.
What should have happened
When the bot is first enabled, it should crawl open PRs and merge ones that match the criteria already
This would be nice (and policy-bot has the same issue), but detecting when the bot is enabled is slightly involved. If you opt-in specific repositories via the GitHub App settings, we can get webhooks for that. But for places where the app is enabled on a full organization, I think we have to:
- Listen for
pushevents on all repositories - For every event, check to see if a
bulldozer.ymlfile was created by that push - If it was, evaluate all open PRs (or only PRs targeting the branch that was updated)
We already do some of that to support PR updates, but I'm not sure we want to add more API calls on an on-going basis for a relatively rare event. Maybe clarifying this behavior in the docs is enough?
I think your suggestion of watching the firehose of push events sounds like a pretty good long term solution, if the server can keep up! Don't think adding documentation will stop people from coming and asking us why bulldozer isn't working yet tbh :/