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

delete_previous_comments has no effect #245

Open
vixus0 opened this issue Dec 9, 2020 · 4 comments
Open

delete_previous_comments has no effect #245

vixus0 opened this issue Dec 9, 2020 · 4 comments

Comments

@vixus0
Copy link
Contributor

vixus0 commented Dec 9, 2020

I'm passing delete_previous_comments: true in the parameters to my put step on this resource, along with comment: my comment. Check status is updated, the new comment gets added but the previous comments are not removed.

I'm using a GitHub app token with read & write permissions on pull requests. Is there anything I'm missing?

@rickardl
Copy link
Contributor

Hi,

Have you tried modifying the E2E test, that's available? Look at TestPutCommentsE2E and modify the underlying owner of the repo, to match one you're using and get back to us with the result.

@vixus0
Copy link
Contributor Author

vixus0 commented Jan 18, 2021

@rickardl I'll give that a try, thanks.

@bee-san
Copy link

bee-san commented Apr 15, 2021

Hey 👋🏻

I had a similar issue, specifically:

  • My user was a GitHub Bot App
  • It didn't delete comments
  • Using OAuth on a personal account it did.
    The issue occurs here:

if e.Node.Author.Login == getComments.Viewer.Login {

When evaluating, it comes out to:

+ if "githubApp" == "githubApp[bot]"
- if e.Node.Author.Login == getComments.Viewer.Login {

Specifically, getComments.Viewer.Login returns the name with [bot] but e.Node.Author.Login returns it without bot.

@bgandon
Copy link

bgandon commented May 11, 2024

Thanks @bee-san for the fix in monzo#4! I've ported it to the new repo and it will soon be shipped.

Because unfortunately, there is no hope that one can get any further support here (#246 was 2+y ago).

But recent news is that the Cloud Foundry community is now maintaining a fork of this resource at cloudfoundry-community/github-pr-resource.

On our Concourse installation at Gstack, that one is working fine. Maybe you guys can give a try and provide feedback there?

(the new resource is a drop-in replacement; you only have to switch telia-ossto cfcommunity in in the resource_types: declaration, i.e. specify repository: cfcommunity/github-pr-resource)

bgandon pushed a commit to cloudfoundry-community/github-pr-resource that referenced this issue May 11, 2024
Indeed, in order to delete the correct comments, the golang code makes sure
that comment's `Author.Login` is the same as current `Viewer.Login`. But with
bot users, viewer's login is "githubApp[bot]" and author login is "githubApp".

As a consequence, for the comparison to succeed, we need to remove any
trailing "[bot]" suffix from both parties, and compare the resulting prefixes.

This isue was originally submitted as telia-oss#245 and
fixed later in monzo#4.
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

No branches or pull requests

4 participants