Skip to content

Commit

Permalink
Use 'line' instead of 'position' (#1566)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Floyd <139819+nickfloyd@users.noreply.github.com>
Co-authored-by: Keegan Campbell <me@kfcampbell.com>
  • Loading branch information
3 people authored Oct 30, 2023
1 parent a34a726 commit 918af86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions lib/octokit/client/pull_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,21 @@ def pull_request_comment(repo, comment_id, options = {})
# @param body [String] Comment content
# @param commit_id [String] Sha of the commit to comment on.
# @param path [String] Relative path of the file to comment on.
# @param position [Integer] Line index in the diff to comment on.
# @param line [Integer] Line index in the diff to comment on.
# For a multi-line comment, the last line of the range
# and specify 'start_line' in the 'options'.
# @return [Sawyer::Resource] Hash representing the new comment
# @deprecated The position will be deprecated in the next major version. Please refer to the details below.
# @see https://developer.github.com/v3/pulls/comments/#create-a-comment
# @example
# @client.create_pull_request_comment("octokit/octokit.rb", 163, ":shipit:",
# "2d3201e4440903d8b04a5487842053ca4883e5f0", "lib/octokit/request.rb", 47)
def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options = {})
octokit_warn 'Deprecated: The position will be deprecated in the next major version.'
def create_pull_request_comment(repo, pull_id, body, commit_id, path, line, options = {})
options.merge!({
body: body,
commit_id: commit_id,
path: path,
position: position
line: line
})
post "#{Repository.path repo}/pulls/#{pull_id}/comments", options
end
Expand Down
4 changes: 2 additions & 2 deletions spec/octokit/client/pull_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
body: 'Hawt',
commit_id: '9bf22dff54fd6a7650230b70417b55e8cccfc4f2',
path: 'test.md',
position: 1
line: 1
}
@comment = @client.create_pull_request_comment \
@test_repo,
@pull.number,
new_comment[:body],
new_comment[:commit_id],
new_comment[:path],
new_comment[:position]
new_comment[:line]
end

describe '.create_pull_request_comment', :vcr do
Expand Down

0 comments on commit 918af86

Please sign in to comment.