diff --git a/src/nimblepkg/common.nim b/src/nimblepkg/common.nim index 436775e..a95e780 100644 --- a/src/nimblepkg/common.nim +++ b/src/nimblepkg/common.nim @@ -63,4 +63,4 @@ when not defined(nimscript): return (error, hint) const - nimbleVersion* = "0.8.10" + nimbleVersion* = "0.8.11" diff --git a/src/nimblepkg/publish.nim b/src/nimblepkg/publish.nim index c597aa3..ce8dbe5 100644 --- a/src/nimblepkg/publish.nim +++ b/src/nimblepkg/publish.nim @@ -94,11 +94,13 @@ proc createFork(a: Auth) = raise newException(NimbleError, "Unable to create fork. Access token" & " might not have enough permissions.") -proc createPullRequest(a: Auth, packageName, branch: string) = +proc createPullRequest(a: Auth, packageName, branch: string): string = display("Info", "Creating PR", priority = HighPriority) - discard a.http.postContent(ReposUrl & "nim-lang/packages/pulls", + var body = a.http.postContent(ReposUrl & "nim-lang/packages/pulls", body="""{"title": "Add package $1", "head": "$2:$3", "base": "master"}""" % [packageName, a.user, branch]) + var pr = parseJson(body) + return pr{"html_url"}.getStr() proc `%`(s: openArray[string]): JsonNode = result = newJArray() @@ -220,5 +222,5 @@ proc publish*(p: PackageInfo, o: Options) = doCmd("git commit packages.json -m \"Added package " & p.name & "\"") display("Pushing", "to remote of fork.", priority = HighPriority) doCmd("git push https://" & auth.token & "@github.com/" & auth.user & "/packages " & branchName) - createPullRequest(auth, p.name, branchName) - display("Success:", "Pull request successful.", Success, HighPriority) \ No newline at end of file + let prUrl = createPullRequest(auth, p.name, branchName) + display("Success:", "Pull request successful, check at " & prUrl , Success, HighPriority)