Add link to the Pull request after nim publish (#483)

* Add link to the pull requests page

* Add version bump

* inline PR url in the nim publish output

* Small fixes on top of PR.
This commit is contained in:
Ahmed T. Youssef 2018-05-04 17:53:39 +02:00 committed by Dominik Picheta
commit b86dca4105
2 changed files with 7 additions and 5 deletions

View file

@ -63,4 +63,4 @@ when not defined(nimscript):
return (error, hint)
const
nimbleVersion* = "0.8.10"
nimbleVersion* = "0.8.11"

View file

@ -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)
let prUrl = createPullRequest(auth, p.name, branchName)
display("Success:", "Pull request successful, check at " & prUrl , Success, HighPriority)