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 auto-merge capability to dlang-bot #17

Merged
merged 4 commits into from
Dec 19, 2016

Conversation

wilzbach
Copy link
Member

No description provided.

Copy link
Member Author

@wilzbach wilzbach left a 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 @@
[
Copy link
Member Author

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));
Copy link
Member Author

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?

Copy link
Member

@MartinNowak MartinNowak Dec 19, 2016

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

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Not important though

Copy link
Member

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"
Copy link
Member

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 :/).

Copy link
Member Author

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

@MartinNowak MartinNowak merged commit fb81dc1 into dlang:master Dec 19, 2016
@MartinNowak
Copy link
Member

Will deploy this later.

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.

2 participants