Skip to content
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

[BUG]: create_pull_request_comment's line needs to be optional to use optional subject_type #1710

Open
1 task done
Al-Campuzano opened this issue Aug 14, 2024 · 1 comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@Al-Campuzano
Copy link

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
@Al-Campuzano Al-Campuzano added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Aug 14, 2024
Copy link

👋 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! 🚀

@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
Status: 🔥 Backlog
Development

No branches or pull requests

2 participants