policy-bot icon indicating copy to clipboard operation
policy-bot copied to clipboard

Support top-level "age" policies

Open bluekeyes opened this issue 7 years ago • 0 comments

One of our internal projects has a high rate of PR creation, which means that PRs that are open for more than a day or two are likely to have semantic merge conflicts with the target branch. Due to the length of builds and the number of PRs, it's currently infeasible to use GitHub's strict required status checks.

One idea is this to add a new top-level policy element, tentatively called age:

policy:
  approval:
    # ...
  disapproval:
    # ...
  age:
    max_days: 4
    max_commits: 20

In the example above, if a PR has been open for more than 4 days (and the target branch has changed) or a PR is more than 20 commits behind the target branch, policy-bot would post a failed status check indicating that the PR needs to be updated.

I'd like to avoid both adding state to track PRs and running large queries to find open PRs in the case of a time window. Is it possible to support this in an event-driven way? Maybe evaluating open PRs in response to the push event on the target branch? It does mean that the status won't necessarily update at or close to the expiration time, only on the next push to the target branch or other evaluation action.

Are there any other conditions that would make sense as part of this policy?

bluekeyes avatar Feb 16 '19 01:02 bluekeyes