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 a Comment Without Creating a New One #251

Closed
joeyagreco-sb opened this issue Jul 8, 2023 · 2 comments
Closed

Delete a Comment Without Creating a New One #251

joeyagreco-sb opened this issue Jul 8, 2023 · 2 comments

Comments

@joeyagreco-sb
Copy link

joeyagreco-sb commented Jul 8, 2023

Desired functionality:

  1. Workflow runs, creating a comment with tag foo
  2. Workflow runs again, deletes the comment with tag foo

Current functionality

  1. Workflow runs, creating a comment with tag foo
  2. Workflow runs again, deletes the comment with tag foo
  3. New comment is created in deletion step
    a. Ideally, you would not have to create a new comment upon deletion of another comment

Here's an example workflow snippet

      - name: Post Comment
        uses: thollander/actions-comment-pull-request@v2
        with:
          message: |
            #### hello world
          comment_tag: foo
          mode: recreate

      - name: Delete Comment
        uses: thollander/actions-comment-pull-request@v2
        with:
          message: |
            #### Why do I need this to delete?
          comment_tag: foo
          mode: delete
          create_if_not_exists: false # thought this may fix it (it does not :/)

At the end of this, the Post Comment comment is deleted, but seemingly always replaced with a new comment that has the contents of the message in the Delete Comment step.

Ideally, there would be a way to delete an existing comment without creating a new one.

If there is a way to do this and I'm missing something here, please let me know

Thanks!

Update: seems this functionality may not be supported by GitHub: https://github.com/orgs/community/discussions/26256

@thollander
Copy link
Owner

After release of 2.4.1, this is not reproduced anymore (thanks to this fix).

What's actually happening is that last comment is created but deleted just after.

cf #267
image

@kdawgwilk
Copy link

The downside still with this approach is that if you have notifications setup to pipe into your company chat like Slack you will get notifications for these placeholder message which get deleted which is a bit confusing

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

3 participants