Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only_has_contributors_in rule #114

Merged
merged 2 commits into from
Aug 15, 2019

Conversation

alexodle
Copy link
Contributor

Use case is when you have more than one set of users (or bots!) that can make pre-approved changes, all of which you want to allow to go through.

In our case, we have one bot that creates PRs, and another bot that ensures the PRs stay up to date with master. In some cases the timing works out where a PR ends up with commits from both bots before it's able to be merged. We want to allow these to push through.

Copy link
Member

@bluekeyes bluekeyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I'm happy to support this, I think the behavior is closer to the existing has_contributor_in, so I'd like to call it only_has_contributors_in instead. The contributor logic considers the author a contributor, so the end behavior is the same.

}

for _, c := range commits {
result, err := pred.IsActor(ctx, prctx, c.Author)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest copying and modifying the logic from the existing HasContribtorIn predicate, as it has a few advantages:

  • It properly considers both the author and the committer of a commit as contributors
  • It avoids running IsActor on the same user more than once (although the internal caching makes this less important)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE!

@alexodle alexodle changed the title only_has_authors_in rule only_has_contributors_in rule Aug 15, 2019
@bluekeyes bluekeyes merged commit 466dcf6 into palantir:develop Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants