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

Add support for file comments in PRs #1717

Merged

Conversation

camillof
Copy link
Contributor

@camillof camillof commented Oct 10, 2024

Resolves #1710


Before the change?

  • Even if you provided a nil line when creating a pull request comment, with the intention of commenting the whole file, you would get an answer like
{
  "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"
}

Per GitHub documentation:

line integer
Required unless using subject_type:file. ...

After the change?

  • If you don't provide a line, the file subject type will be used, allowing users to create file comments.

client.create_pull_request_comment(repo, pr_number, body, commit, path)

image

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

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

@camillof camillof marked this pull request as ready for review October 10, 2024 17:47
Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable. Thanks for the change!

@kfcampbell kfcampbell merged commit c0ce2e5 into octokit:main Oct 11, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[BUG]: create_pull_request_comment's line needs to be optional to use optional subject_type
2 participants