kodiak icon indicating copy to clipboard operation
kodiak copied to clipboard

Restrict merges to during working hours

Open dpraul opened this issue 5 years ago • 10 comments

Hi! Great bot - hoping to integrate it further as we play around with it more.

Dependabot has an excellent setting where auto-merging can be restricted to only occur during working hours, like so: image

Would love to see a feature like this here!

dpraul avatar Mar 17 '20 20:03 dpraul

That's a cool idea. I don't think it would be too difficult to add, but I'm unsure of how to express this in .kodiak.toml.

These are a few ideas I came up with:

verbose

[merge.automerge_schedule.days.sunday]
start = 07:32:00
end = 12:32:00
[merge.automerge_schedule.days.monday]
start = 07:32:00
end = 12:32:00
[merge.automerge_schedule.days.tuesday]
start = 07:32:00
end = 12:32:00
[merge.automerge_schedule.days.wednesday]
start = 07:32:00
end = 12:32:00
[merge.automerge_schedule.days.thursday]
start = 07:32:00
end = 12:32:00
[merge.automerge_schedule.days.friday]
start = 07:32:00
end = 12:32:00
[merge.automerge_schedule.days.saturday]
start = 07:32:00
end = 12:32:00

inline

[merge.automerge_schedule.days]
monday = {start = 07:32:00, end = 12:32:00}
tuesday = {start = 07:32:00, end = 12:32:00}
wednesday = {start = 07:32:00, end = 12:32:00}
thursday = {start = 07:32:00, end = 12:32:00}
friday = {start = 07:32:00, end = 12:32:00}
saturday = {start = 07:32:00, end = 12:32:00}
sunday = {start = 07:32:00, end = 12:32:00}

minimalist

[merge.automerge_schedule.days]
monday = [07:32:00, 12:32:00]
tuesday = [07:32:00, 12:32:00]
wednesday = [07:32:00, 12:32:00]
thursday = [07:32:00, 12:32:00]
friday = [07:32:00, 12:32:00]
saturday = [07:32:00, 12:32:00]
sunday = [07:32:00, 12:32:00]

I'm curious if you have any other suggestions.

EDIT: looking at this a couple times more I think I'm personally learning towards the inline exmaple

chdsbd avatar Mar 17 '20 23:03 chdsbd

Also needs a timezone setting of some sort

sbdchd avatar Mar 17 '20 23:03 sbdchd

I imagine it should also account for:

  1. days where there should be no merging
  2. people who want the schedule to be the same for all days

Inline is easiest to read but I think it makes it hard to account for (2) - but that's not totally essential to optimize for

dpraul avatar Mar 18 '20 14:03 dpraul

Maybe something like this where we have some global settings and allow individual days to be overridden.

[merge.automerge_schedule]
timezone = 'America/New_York'
# specify global start/end times
start = 07:32:00
end = 12:32:00

# override global times by day
[merge.automerge_schedule.days]
monday = {start = 07:32:00, end = 12:32:00}
tuesday = {start = 07:32:00, end = 12:32:00}
wednesday = {start = 07:32:00, end = 12:32:00}
thursday = {start = 07:32:00, end = 12:32:00}
friday = {start = 07:32:00, end = 12:32:00}
# don't merge on specific days by setting an empty table
saturday = {}
# alternatively I think using a boolean is more clear
sunday = false

chdsbd avatar Mar 18 '20 22:03 chdsbd

that makes sense to me!

dpraul avatar Mar 19 '20 12:03 dpraul

Would your expectation be that if a PR was opened outside of the merge window, it would be merge upon the next opening?

I guess that would require a bit more work than simply ignoring a PR outside of the window because Kodiak would need to track PRs opened outside the window and trigger evaluation once the new time period comes around. Anyway, I think I know how to do it.

EDIT: Also, is this something you're still interested in seeing in Kodiak?

chdsbd avatar May 05 '20 00:05 chdsbd

Yes, I think I would expect it to keep track and start merging again once the next merge window opens.

And yes, still interested in seeing this - it would make kodiak more compelling for us

dpraul avatar May 05 '20 13:05 dpraul

I found this GitHub bot which you can configure to block merging based on a schedule. It doesn't completely solve this issue because it will block merging completely, not just auto merging.

https://github.com/marketplace/merge-freeze

chdsbd avatar Jul 03 '20 20:07 chdsbd

@chdsbd came here searching for a feature to setup scheduled merges. like add automerge label but merge it a specific time instead of doing it immediately. maybe a separate label along with automerge to specify the time of merge?

chirag04 avatar Nov 19 '20 18:11 chirag04

I guess it could be pretty easy to setup a github action which errors when started within the time-window. Additionally mark this check as mandatory, so dependabot will not merge until this check is green

staabm avatar Dec 30 '20 14:12 staabm