Open kaushalmodi opened 5 years ago
Do you see this every time or sporadically? I just tried from Linux with latest devel and it worked just fine. I couldn't find anything useful around 422 for PR creation.
Yes, I've seen this every time. Every time I do nimble publish
(I think I have done 3 times), it goes all the way to submitting the PR, and then I get this error. Then I go to github.com, take the nimble publish
created branch and submit the PR manually.
I've seen protocol error before but never this. Can you check if you have the right permissions on the oauth token you are using?
I have deleted and recreated the token with the nimble
suggested public_repo
scope and even the full repo
scope, and still I get the same error.
Seems like the httpclient.nim
code has changed, so the line number in the error has changed:
Pushing to remote of fork.
Info Creating PR
../../../lib/pure/httpclient.nim(1012) responseContent
Error: unhandled exception: 422 Unprocessable Entity [HttpRequestError]
I attempted a little bit of debug, but I didn't get anything useful:
I added debug statements to the createPullRequest
proc:
# Added import strformat at the top
proc createPullRequest(a: Auth, packageName, branch: string): string =
display("Info", "Creating PR", priority = HighPriority)
let
url = ReposUrl & "nim-lang/packages/pulls"
bodyStr = """{"title": "Add package $1", "head": "$2:$3", "base": "master"}""" % [packageName, a.user, branch]
echo &"dbg: {url}"
echo &"dbg: {bodyStr}"
var body = a.http.postContent(url, body=bodyStr)
echo &"dbg: {body}"
var pr = parseJson(body)
return pr{"html_url"}.getStr()
This was the output:
> /home/kmodi/sandbox/nim/nimble/nimble publish
Info: Using GitHub API Token in file: /home/kmodi/.nimble/github_api_token
Success: Verified as kaushalmodi
Copying packages fork into: /tmp/nimble-packages-fork
Updating the fork
Prompt: Whitespace separated list of tags?
Answer: asdf
Pushing to remote of fork.
Info Creating PR
dbg: https://api.github.com/repos/nim-lang/packages/pulls
dbg: {"title": "Add package svdpi", "head": "kaushalmodi:add-svdpi0509", "base": "master"}
nimble.nim(1145) nimble
nimble.nim(1110) doAction
publish.nim(229) publish
publish.nim(104) createPullRequest
httpclient.nim(1077) postContent
httpclient.nim(1012) responseContent
Error: unhandled exception: 422 Unprocessable Entity [HttpRequestError]
OK, I figured out the problem.
Earlier my "packages" repo fork was at https://github.com/kaushalmodi/packages. At some point I moved it to my "forks Organization". So the new URL was https://github.com/kaushalmodi-forks/packages.
GitHub auto-redirected https://github.com/kaushalmodi-forks/packages to https://github.com/kaushalmodi/packages.
That's when this issue was happening.
Now I once again moved that fork from my "kaushalmodi-forks" Organization to my "kaushalmodi" username, and this issue got resolved.
(Now https://github.com/kaushalmodi-forks/packages redirects to https://github.com/kaushalmodi/packages.)
So closing this issue.
I was successfully able to create this test PR: https://github.com/nim-lang/packages/pull/1089
This is still a bug, any way we could catch this and print a nicer error?
Hello,
Today I was trying to publish a new package (now PR'ed manually: https://github.com/nim-lang/packages/pull/1076).
I tried the
nimble publish
command and I got:So it successfully created the fork, a branch with the correct changes in that fork, but just failed at the PR creation.
Version info
nimble --version
nim --version