Skip to content

Add the ability to delete the "last" comment, similar to --edit-last #10366

@erawhctim

Description

@erawhctim

Describe the feature or problem you’d like to solve

I'd love to see a way to delete PR and issue comments with the CLI.

This previous issue highlighted some questions/friction around a potential delete --id 1234 type command, which I think are valid concerns.

I'd like to propose an ability to delete comments by building off of the existing behavior of --edit-last

Proposed solution

gh [issue|pr] comment --edit-last --delete or gh [issue|pr] comment --delete-last

This command would remove the last comment made by the CLI user, similar to how --edit-last works.

  • This would benefit users by offering some type of comment delete functionality in the CLI, while avoiding the complexity/uncertainty of having to discover a comment ID to supply to the delete command.
  • This would align with existing behavior (--edit-last flag)

Additional context

I don't think this would totally solve all the requests for a "delete comment" type command. It may solve a portion of them (e.g. use cases that leverage CI bots to leave comments) - maybe that is an acceptable compromise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-issuerelating to the gh issue commandgh-prrelating to the gh pr commandhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions