[BUG]: `create_pull_request_comment`'s `line` needs to be optional to use optional `subject_type`
Al-Campuzano opened this issue · 1 comments
What happened?
Trying to leave a comment on a file-level does not work using the create_pull_request_comment
because i have to pass nil
as the line number, and then the option
hash { subject_type: "file" }
(as per the GitHub docs, line is optional when using subject_type: file
(screenshot))
However, doing so passes the explicit key line: nil
to the GitHub endpoint and that results in the following error:
{
"message": "Invalid request.\n\nNo subschema in \"oneOf\" matched.\n\"position\" wasn't supplied.\n\"in_reply_to\" wasn't supplied.\n\"subject_type\" is not a permitted key.\nFor 'properties/line', nil is not an integer.\n\"line\" is not a permitted key.",
"documentation_url": "https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request",
"status": "422"
}
Locally i put a breakpoint after line 215 here and manually deleted the line
key from the options
hash, then let the post request continue with the modified hash and the comment was created successfully on the PR.
Versions
Octokit.rb v9.1.0
Ruby 3.3.1
Relevant log output
/Users/albertocampuzano/.gem/ruby/3.3.1/gems/octokit-9.1.0/lib/octokit/response/raise_error.rb:14:in `on_complete': POST https://api.github.com/repositories/103479113/pulls/1460/comments: 422 - Invalid request. (Octokit::UnprocessableEntity)
No subschema in "oneOf" matched.
"position" wasn't supplied.
"in_reply_to" wasn't supplied.
"subject_type" is not a permitted key.
For 'properties/line', nil is not an integer.
"line" is not a permitted key. // See: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request
Code of Conduct
- I agree to follow this project's Code of Conduct
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs
. You & others like you are the reason all of this works! So thank you & happy coding! 🚀