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

Remove usage of deprecated position argument for GitHub comments #455

Merged

Conversation

pbstriker38
Copy link
Contributor

@pbstriker38 pbstriker38 commented Nov 3, 2023

  • This allows usage of Octokit v8.0.0

Fixes: #453

@pbstriker38 pbstriker38 requested a review from a team as a code owner November 3, 2023 00:19
@pbstriker38 pbstriker38 force-pushed the fix_deprecated_pr_comment_position branch from 9c61395 to 5a49d92 Compare November 3, 2023 00:21
@ashkulz
Copy link
Member

ashkulz commented Nov 3, 2023

@pbstriker38 I'm not sure this works with older versions of octokit -- what do you think of bumping the dependency? Without verifying that it works, I'd be a bit hesitant to merge this as-is.

@pbstriker38
Copy link
Contributor Author

pbstriker38 commented Nov 3, 2023

@ashkulz I did verify that it works with both versions. On Octokit 7.2.0 it sends both position and line params. The API ignores postion and uses line. On Octokit 8.0.0 the params are merged into the options and thus the line is merged.

The other option I can do here is to not use Octokit#create_pull_comment method and to just use Octokit#post directly like so:

options = {
  body: comment.body,
  commit_id: pull_sha || comment.sha,
  path: comment.path,
  line: comment.position
}
client.post("#{Octokit::Repository.path(slug)}/pulls/#{pull_id}/comments", options)

@pbstriker38
Copy link
Contributor Author

I did not test earlier Octokit versions though. I can try and test those too.

  • 4.7.0
  • 5.x.x
  • 6.x.x

@ashkulz ashkulz merged commit 61beff7 into prontolabs:master Nov 9, 2023
10 of 11 checks passed
@ashkulz
Copy link
Member

ashkulz commented Nov 9, 2023

Thanks for the contribution and being patient while we figured things out, @pbstriker38!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow Octokit 8.0
2 participants