Skip to content

Commit

Permalink
Use in_reply_to_id to lookup GitHub replies
Browse files Browse the repository at this point in the history
  • Loading branch information
kemchenj committed Nov 13, 2022
1 parent 99bc6c7 commit d5a1c1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

<!-- Your comment above here -->

* Use `in_reply_to_id` to lookup GitHub replies - [@kemchenj](https:/kemchenj.github.io/)

## 9.1.0

* Fixed Docker image outdated ruby version by updating it to 2.7. [@axl89](https://github.com/axl89) [#1383](https://github.com/danger/danger/issues/1383)
Expand Down
6 changes: 1 addition & 5 deletions lib/danger/request_sources/github/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,8 @@ def submit_inline_comments!(warnings: [], errors: [], messages: [], markdowns: [
client.update_pull_request_comment(ci_source.repo_slug, comment["id"], body)
else
# We remove non-sticky violations that have no replies
# Since there's no direct concept of a reply in GH, we simply consider
# the existence of non-danger comments in that line as replies
replies = non_danger_comments.select do |potential|
potential["path"] == comment["path"] &&
potential["position"] == comment["position"] &&
potential["commit_id"] == comment["commit_id"]
potential['in_reply_to_id'] == comment['id']
end

client.delete_pull_request_comment(ci_source.repo_slug, comment["id"]) if replies.empty?
Expand Down

0 comments on commit d5a1c1e

Please sign in to comment.