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

[WIP] Remove outdated comments #335

Closed
wants to merge 1 commit into from
Closed

[WIP] Remove outdated comments #335

wants to merge 1 commit into from

Conversation

gyfis
Copy link
Contributor

@gyfis gyfis commented Mar 25, 2019

This is a work in progress PR, which I submitted to collect feedback along the way.

The idea is that if a comment doesn't have a line (or had a line and doesn't have one anymore), it's outdated and we can remove it on next pass. This info is very easy to get from the Github API; not sure about Bitbucket and Gitlab yet.

I think that with keeping this option off as a default, it may be a nice addition to pronto.

Remaining TODOs:

  • Add the remove outdated comments option to config
  • Cleanup Github implementation
  • Implement Bitbucket
  • Implement Gitlab

@doomspork
Copy link
Member

@gyfis howdy! Just wanted to check in with you on the status of your PR. Should we keep this open or close it? If you're still working on this we can get the team assigned for reviews 😁

@gyfis
Copy link
Contributor Author

gyfis commented May 18, 2019

@doomspork I actually implemented a custom solution for our case that removes all comments before running pronto, since I didn't find out a good way of implementing the "outdated" functionality; I don't plan on digging deeper for now, so I'll close this PR. Thanks for reminding me!

@gyfis gyfis closed this May 18, 2019
@gyfis gyfis deleted the th/delete-outdated-comments branch May 18, 2019 20:53
@misteral
Copy link

@gyfis hi, how do u do it?

removes all comments before running pronto

@gyfis
Copy link
Contributor Author

gyfis commented Feb 18, 2022

@misteral Hey Aleksander, I used the GitHub API for that, through the Ruby client:

REPO_SLUG='your/repo'
BOT_LOGIN='bot-username'

client = Octokit::Client.new(api_endpoint: 'https://api.github.com/', web_endpoint: 'https://github.com/', access_token: ENV['GITHUB_ACCESS_TOKEN'], auto_paginate: true)

client
  .pull_comments(REPO_SLUG, ENV['PR_NUMBER'])
  .select { |c| c[:user][:login] == BOT_LOGIN }
  .each { |c| client.delete_pull_request_comment(REPO_SLUG, c[:id]) }

client
  .issue_comments(REPO_SLUG, ENV['PR_NUMBER'])
  .select { |c| c[:user][:login] == BOT_LOGIN }
  .each { |c| client.delete_comment(REPO_SLUG, c[:id]) }

@misteral
Copy link

@gyfis Hey Tomas, thanks! I will implement in same way for Bitbucket format.

@misteral
Copy link

@gyfis Hey Tomas, PR for Bitbucket #421

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

Successfully merging this pull request may close these issues.

None yet

3 participants