-
-
Notifications
You must be signed in to change notification settings - Fork 14
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 auto-merge capability to dlang-bot #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
@@ -0,0 +1,67 @@ | |||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - with the issue API we can directly get the correct subset :)
@@ -38,6 +42,8 @@ void startServer(HTTPServerSettings settings) | |||
settings.bindAddresses = ["0.0.0.0"]; | |||
settings.options = HTTPServerOption.defaults & ~HTTPServerOption.parseJsonBody; | |||
|
|||
lastFullPRCheck = SysTime(Date(0, 1, 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: SysTime.min
is there, but didn't work. I guess it underflows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supposed to work, but Duration represents differences of hnsecs.
https://dlang.org/library/std/datetime/sys_time.min.html
import std.datetime;
Clock.currTime - SysTime.min;
-1419840 weeks, -3 days, -2 hours, -21 minutes, -37 secs, -762 ms, -353 μs, and -8 hnsecs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use MonoTime instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or check relatively lastFullPRCheck + 5.minutes > Clock.currTime
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not important though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SysTime.init is zero and won't overflow, both SysTime and Duration use long hnsecs internally.
|
||
void searchForAutoMergePrs(string repoSlug) | ||
{ | ||
auto issues = ghGetRequest("%s/repos/%s/issues?state=open&labels=auto-merge,auto-merge-squash" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this is a logical AND between the labels, see https://api.github.com/repos/dlang/phobos/issues?state=open&labels=blocked,dependency. Searched the net, there doesn't seem to be an OR, so we'd need 2 queries (and maybe an intersection :/).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this is a logical AND between the labels,
Wow good catch! -> updated
Will deploy this later. |
No description provided.