-
Notifications
You must be signed in to change notification settings - Fork 749
FEAT: Implement enabling auto merge for PR by GraphQL #2056
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
Conversation
0757692
to
c7f0d59
Compare
@bitwiseman |
|
c5cb88b
to
b99a876
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2056 +/- ##
============================================
+ Coverage 83.58% 83.83% +0.24%
- Complexity 2380 2412 +32
============================================
Files 235 236 +1
Lines 7262 7324 +62
Branches 382 389 +7
============================================
+ Hits 6070 6140 +70
+ Misses 956 952 -4
+ Partials 236 232 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
String ownerName = owner.getOwnerName(); | ||
|
||
String graphqlBody = String.format( | ||
"query GetPullRequestID { repository(name: \"%s\", owner: \"%s\") { pullRequest(number: %d) { id } } }", |
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 might not need this method. I think this GraphQL id
field is already available from GHPullRequest.getNodeId()
(inherited from GHObject
).
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.
Oh I didn't know it! I will change it.
1839bf6
to
0c63dfb
Compare
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.
Great! Some suggestions that will reduce the amount of code you'll need to cover with tests.
* if there is an I/O Exception. | ||
*/ | ||
@CheckForNull | ||
static <T> GHGraphQLResponse<T> parseGraphQLBody(GitHubConnectorResponse connectorResponse, Class<T> type) |
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.
I don't think you need this specialized method either... using regular parseBody()
should be enough, right?
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.
I thoght that using generic is better than just Object class in data field in GHGraphQLResponse class.
Because I thought this way is easier to get information by serialization than writing another method to get information.
And this can't be achieved by parseBody()
when using generic field in GHGraphQLResponse class.
That's why I implemented this method.
Or there are some ways that this can be achieved that I don't know?
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.
Agreed generic is better.
And you're correct with a bare generic (such as GHGraphQLResponse<T>
), you can pass the type - GHGraphQLResponse<GHSomeDataRecord>.class
doesn't work.
But you can get around this limitation by creating a concrete class of the type you need.
public class GHSomeDataRecordResponse extends GHGraphQLResponse<GHSomeDataRecord> {
...
}
Then you can pass GHSomeDataRecordResponse.class
.
In the case of sendGraphQL()
the returned data is not read, so Object
is fine and I created a GHGraphQLResponse.ObjectResponse.class
for that.
6cf65e0#diff-02b0c52659b0fb57bd257b850d25db8da3763545e6e429dc24fc693510487ce0R114
@seate |
Oh I couldn't recognize your comment. sorry! |
@seate https://github.com/hub4j/github-api/tree/feat/pr-2056 Two commits in that branch: If you do a |
@bitwiseman |
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.
Thanks for this PR! I know we made a bunch of changes, but I want to make you know that this was a good PR from the start. I especially appreciated the unit and functional tests. All the changes were tweaks to the solid base functionality.
I look forward to your future contributions.
I apologize for my inexperience and appreciate to help my PR. It was great experience. |
@seate thanks for implementing this! |
Description
Implement to enable Auto merge for PR by GraphQL.
Before submitting a PR:
@link
JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .mvn -D enable-ci clean install site
locally. If this command doesn't succeed, your change will not pass CI.main
. You will create your PR from that branch.When creating a PR: