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

Add request_reviews and update Mergify actions #320

Merged
merged 7 commits into from
Jul 5, 2022

Conversation

bpholt
Copy link
Member

@bpholt bpholt commented Jun 30, 2022

Most of our OSS projects use the request_reviews and update Mergify actions, which aren't supported yet. e.g. https://github.com/Dwolla/fs2-pgp/blob/main/.mergify.yml

We have also typically used merge queues instead of merging directly, but I'm not sure how important that is. I remember we switched from "strict" merges when Mergify deprecated them, but maybe that was overkill for our needs. I'll play with it and see; we can always add that in a future PR.

@mergify mergify bot added the mergify label Jun 30, 2022
@bpholt
Copy link
Member Author

bpholt commented Jun 30, 2022

Not sure if I targeted the right branch for this PR—feel free to retarget if necessary.

@armanbilge
Copy link
Member

Thanks! You may want to retarget to series/0.4, main is going to be 0.5.0, someday ...

@bpholt bpholt changed the base branch from main to series/0.4 June 30, 2022 23:13
@bpholt bpholt changed the base branch from series/0.4 to main June 30, 2022 23:13
@bpholt
Copy link
Member Author

bpholt commented Jun 30, 2022

I'll rebase and push it up for series/0.4

@bpholt bpholt force-pushed the mergify-actions branch from c27cd43 to 24ab90c Compare June 30, 2022 23:18
@bpholt bpholt changed the base branch from main to series/0.4 June 30, 2022 23:18
@armanbilge armanbilge closed this Jun 30, 2022
@armanbilge armanbilge reopened this Jun 30, 2022
@@ -57,6 +59,21 @@ object MergifyAction {
}
}

final case class RequestReviews(users: List[String] = Nil) extends MergifyAction {
Copy link
Member

Choose a reason for hiding this comment

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

Can we also add the teams and users_from_teams keys?. Also frustratingly seems like all of these can be either a List or a Map. I wonder if we should just go with the Map since it subsumes List and maybe add some helpful constructors.

https://docs.mergify.com/actions/request_reviews/

I know it's annoying, but fixing these binary-compatibly will be even more annoying :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, I'll play with this tomorrow or later this weekend.

Copy link
Member Author

Choose a reason for hiding this comment

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

Had some extra time tonight after all. WDYT of what I just pushed up?

(I wondered whether any of these should be case classes if we're worried about bincompat, btw. Should I change the others too?)

@bpholt bpholt force-pushed the mergify-actions branch from 24ab90c to d478996 Compare July 1, 2022 03:30
Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Yeah, case classes are a usability vs maintainability trade-off. I think it's okay to use them here, as long as we do our best to include all the members right from the start. Bincompat is not a huge deal for an sbt plugin, but I still like to avoid breaking it if I can.

@@ -59,16 +61,30 @@ object MergifyAction {
}
}

final case class RequestReviews(users: List[String] = Nil) extends MergifyAction {
final class RequestReviews(val users: Either[Seq[String], Map[String, Int]], val randomCount: Option[Int]) extends MergifyAction {
Copy link
Member

Choose a reason for hiding this comment

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

Rather than Either I wonder if we should just use a Map, since a List is equivalent to a Map with all weights the same e.g. 1. Also I can't remember how Either renders by default with Circe?

The generated config will be a bit weird, but it's technically not user-facing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also I can't remember how Either renders by default with Circe

I folded them together so that if it's a list it gets rendered without the weights—I was thinking it would be kind of confusing to have weights if they're not specified. I know it's not something users should be editing, but it's still visible and people could be spot-checking it or copy/pasting it into the Mergify config editor for validation or to see what rules would be triggered on different PRs.

Copy link
Member

@armanbilge armanbilge Jul 1, 2022

Choose a reason for hiding this comment

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

Ok, fair point. Let's keep it then. How does Circe generate yaml from Either?

Actually, you can add a RequestReviews action to the sbt-typelevel mergify config in build.sbt so we can dog-food this :)

@bpholt bpholt force-pushed the mergify-actions branch from 5b84cbf to bc28493 Compare July 1, 2022 16:06
@bpholt bpholt force-pushed the mergify-actions branch from 1ae0a5d to f84aa99 Compare July 1, 2022 16:49
build.sbt Outdated Show resolved Hide resolved
.mergify.yml Outdated Show resolved Hide resolved
@bpholt bpholt force-pushed the mergify-actions branch 2 times, most recently from 9cf4e4a to 2d06c9b Compare July 1, 2022 18:03
@bpholt bpholt force-pushed the mergify-actions branch from 2d06c9b to b106844 Compare July 1, 2022 18:12
Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Thanks for all your work on this! It's very nice, and sets a good example of the de-case-classification we'll need to do for feral 😬

@armanbilge armanbilge merged commit 42eec29 into typelevel:series/0.4 Jul 5, 2022
@bpholt bpholt deleted the mergify-actions branch July 6, 2022 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants