Open DepickereSven opened 2 years ago
Most of this workflow is possible except for the final request: there is no way to selectively re-request reviews based on the files changed.
Because the invalidate_on_push
option applies at the rule level, you can create a policy like this, where technical people have to review all changes on every push, while non-technical people only need to review once:
policy:
approval:
- docs changes are approved
- code changes are approved
approval_rules:
- name: docs changes are approved
if:
changed_files:
paths:
- "docs/.*"
options:
invalidate_on_push: false
requires:
count: 1
teams: ["my-org/docs-reviewers"]
- name: code changes are approved
options:
invalidate_on_push: true
requires:
count: 1
teams: ["my-org/code-reviewers"]
This has a few disadvantages but these might be acceptable:
The main limitation for implementing this feature is that we only build modified file lists using the full pull request, rather than the changes in individual commits. If you want to try implementing this feature, I think you will need to:
I think this also opens the question of if there are any other predicates that should have the same behavior. Overall, while possible, I believe this would require refactoring some of the more complicated parts of Policy Bot.
@bluekeyes thank you for the clear explanation.
While evaluating this Policy-bot rules, we got some feedback:
Once the first rule is approved, that approval is never invalidated, even if documentation changes again This wouldn't be acceptable from the docs-reviewers, because they can push on-reviewed documentation once they got an approval.
The second rule is invalidated by any push, even if the update only touched documentation. Your technical reviewers must review all changes. This approach is what we're currently using, it's causing a lot of overhead for our docs-reviewers.
So would be open to develop this feature, if that's a feature that would be accepted for Policy-bot.
I think it makes sense to limit the impact of invalidate_on_push
to rules with no file predicates and rules with matching file predicates. From that perspective, I would accept a PR implementing this feature.
My main concerns are what I outlined earlier. I think this will touch some of the most complicated parts of Policy Bot, could increase the number of API calls made for each evaluation, and requires care because it modifies core logic. I don't want to discourage you from trying this, but I expect it will take a while to get an initial version working and then require iteration on the PR to get something we can merge and support.
We have the following use case:
We have non-technical people checking a certain number of files that contain files that will generate documentation. So when they find that documentation looks fine they will approve it.
But whenever something gets pushed the bot will ask for approval again. Would it be possible to have something as follows:
If there is a change in their scope they should be asked to review the changes of course.
Does something already exist? Or is possible to give some pointers so we can make PR for this feature?