-
Notifications
You must be signed in to change notification settings - Fork 38
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
Use Yojson to parse github json responses #177
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.
This is a much welcome change! Thanks for working on this.
We could go even further but this is already a very good first step!
Some things need to be adjusted though. I think every function parsing an API response should be tested and in particular it should behave properly on the example response from https://developer.github.com/v3.
These kind of test would rule out the bug with Location
for instance!
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.
Changes look good! I have a few suggestions to slightly improve it, let me know what you think!
@NathanReb I have a weird bug when testing this PR with dune-release-testing (when uploading the release asset), and I'm at the point where I'm doubting my testing setup is messed up (I reduced this PR to the minimum), can you confirm you get a similar error? |
I just went through releasing
|
I found what the probllem is, in some cases dune-release correctly works with this patch. |
It turns out the issue was due to a missing edit: I will let the tests as is afterall, @NathanReb can we merge it? |
Missing '-D' arg for upload archive request, otherwise the headers end up in the body Make default_body a JSON entity
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.
This seems like a very nice change to me. Before, for me, it was pretty tedious and hard to read through that part of the code and now it has become far clearer and also seems less error-prone. Thanks!
Of course, I'm missing a lot of context by the long history of discussion you've had on this, so there might be things I'm missing. But the code seems clear.
"-D"; | ||
"-"; |
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.
For me it has been a bit hard to understand why the "-D -" is necessary even after reading the commit message. I've understood it after reading the discussion. I'm wondering if it might be worth improving the commit message (or even leaving a comment here); for example, by mentioning that having the headers in the body messes up the JSON-structure of the body and by choosing a sentence that makes clear the causality (no "-D" argument => headers in the body). The latter e.g. by replacing "missing" with "added" in your commit message or so. What do you think?
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.
That's true this is a bit obscure. I'm not sure the commit message is a good place for this, I was thinking of adding a few comments in the code to explain the arguments or define a simple abstraction to have a named variable for each argument, instead of handling string literals (curly
should have done that, since it's only curl
arguments but it can't hurt doing it ourselves) but this is a bigger change so it would be in another PR.
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 like the idea of making that precise inside the code either by named variables or by comments. So yes, let's leave that for another PR.
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.
Looks great, thanks!
CHANGES: ### Added - Add a `dune-release config` subcommand to display and edit the global configuration (tarides/dune-release#220, @NathanReb). - Add command `delegate-info` to print information needed by external release scripts (tarides/dune-release#221, @pitag-ha) - Use Curly instead of Cmd to interact with github (tarides/dune-release#202, @gpetiot) - Add `x-commit-hash` field to the opam file when releasing (tarides/dune-release#224, @gpetiot) - Add support for common alternative names for the license and ChangeLog file (tarides/dune-release#204, @paurkedal) ### Changed - Command `tag`: improve error and log messages by comparing the provided commit with the commit correspondent to the provided tag (tarides/dune-release#226, @pitag-ha) - Error logs: when an external command fails, include its error message in the error message posted by `dune-release` (tarides/dune-release#231, @pitag-ha) - Error log formatting: avoid unnecessary line-breaks; indent only slightly in multi-lines (tarides/dune-release#234, @pitag-ha) - Linting step of `dune-release distrib` does not fail when opam's `doc` field is missing. Do not try to generate nor publish the documentation when opam's `doc` field is missing. (tarides/dune-release#235, @gpetiot) ### Deprecated - Deprecate opam 1.x (tarides/dune-release#195, @gpetiot) ### Fixed - Separate packages names by spaces in `publish` logs (tarides/dune-release#171, @hannesm) - Fix uncaught exceptions in distrib subcommand and replace them with proper error messages (tarides/dune-release#176, @gpetiot) - Use the 'user' field in the configuration before inferring it from repo URI and handles HTTPS URIs (tarides/dune-release#183, @gpetiot) - Ignore backup files when looking for README, CHANGES and LICENSE files (tarides/dune-release#194, @gpetiot) - Do not echo input characters when reading token (tarides/dune-release#199, @gpetiot) - Improve the output of VCS command errors (tarides/dune-release#193, @gpetiot) - Better error handling when checking opam version (tarides/dune-release#195, @gpetiot) - Do not write 'version' and 'name' fields in opam file (tarides/dune-release#200, @gpetiot) - Use Yojson to parse github json response and avoid parsing bugs. (tarides/dune-release#177, @gpetiot) - The `git` command used in `publish doc` should check `DUNE_RELEASE_GIT` (even if deprecated) before `PATH`. (tarides/dune-release#242, @gpetiot) - Adapt the docs to the removal of the `log` subcommand (tarides/dune-release#196, @gpetiot) ### Removed ### Security
First step towards fixing #175