-
Notifications
You must be signed in to change notification settings - Fork 75
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
Arf 105 create pull request api #109
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.
Minor comments but we should add the docs for these two new operations here
val invalidNewPullRequestData = NewPullRequestData("", "") | ||
|
||
val validNewPullRequestIssue = NewPullRequestIssue(26) | ||
val invalidNewPullRequestIssue = NewPullRequestIssue(5) |
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.
The invalid
vals are not used, could you please remove them?
* requests in the same network, namespace head with a user like this: username:branch. | ||
* @param base Required. The name of the branch you want the changes pulled into. This should be an existing branch | ||
* on the current repository. You cannot submit a pull request to one repository that | ||
* @param maintainerCanModify Indicates whether maintainers can modify the pull request. |
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.
Bad indentation, please remove the tabs in the scaladocs. Also, please specify that the value for maintainerCanModify
is true
by default
base, | ||
maintainerCanModify).asJson.noSpaces) | ||
|
||
} |
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 think it's more clear to create the data
first and then make the call, something like:
def create(
accessToken: Option[String] = None,
headers: Map[String, String] = Map(),
owner: String,
repo: String,
newPullRequest: NewPullRequest,
head: String,
base: String,
maintainerCanModify: Option[Boolean] = Some(true)): M[GHResponse[PullRequest]] = {
val data = newPullRequest match {
case NewPullRequestData(title, body) ⇒
CreatePullRequestData(title, head, base, body, maintainerCanModify)
case NewPullRequestIssue(issue) ⇒
CreatePullRequestIssue(issue, head, base, maintainerCanModify)
httpClient.post[PullRequest](accessToken, s"repos/$owner/$repo/pulls", headers, data.asJson.noSpaces)
}
Also, please add the tests in |
Update pull_request.md
…overage Fixes a field name in `CreatePullRequest` and increases test coverage
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
==========================================
- Coverage 88.14% 88.01% -0.13%
==========================================
Files 36 36
Lines 506 534 +28
Branches 3 3
==========================================
+ Hits 446 470 +24
- Misses 60 64 +4
Continue to review full report at Codecov.
|
docs/src/main/tut/pull_request.md
Outdated
|
||
## Create a pull request | ||
If you want to create a pull request,we have two ways to create a pull request. |
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.
--pull request,we have
++pull request, we have
docs/src/main/tut/pull_request.md
Outdated
``` | ||
|
||
On the other hand, we can pass a `issue` id (in `NewPullRequestIssue` object) instead of title and body to get this parameter of the issue |
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.
--we can pass a `issue`
++we can pass an `issue`
-- (in `NewPullRequestIssue` object)
++ (as part of the `NewPullRequestIssue` object)
-- instead of title and body to get this parameter of the issue
++ instead of the title and the body to get this parameter of the issue.
docs/src/main/tut/pull_request.md
Outdated
On the other hand, we can pass a `issue` id (in `NewPullRequestIssue` object) instead of title and body to get this parameter of the issue | ||
|
||
**NOTE**: This option delete the issue |
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.
It should end with full stop char .
.
-- This option delete
++ This option deletes
decode[Repository](emptyListResponse).isLeft shouldBe true | ||
} | ||
|
||
"StatusRepository decoder" should "return a valid repo for a valid JSON" in { |
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.
CombinedStatus decoder
@@ -608,11 +608,59 @@ class ApiSpec | |||
accessToken, | |||
headerUserAgent, | |||
validRepoOwner, | |||
invalidRepoName, | |||
validPRRepoName, |
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.
Either the test banner or this value are wrong. We should make this consistent.
@@ -111,16 +111,33 @@ trait TestUtils { | |||
val validPullRequestFileSha = "f80f79cafbe3f2ba71311b82e1171e73bd37a470" | |||
val validPullRequestNumber = 1 | |||
|
|||
val validPRRepoName = "sbt-dependencies-test" |
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.
What would happen if this repository is deleted?
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.
We could use github4s
… into arf-105-Create-Pull-Request-API # Conflicts: # github4s/jvm/src/test/scala/github4s/unit/ApiSpec.scala
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.
Fixes #105 Create PullRequest Api integration