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

Removing a comment #108

Open
estahn opened this issue Aug 30, 2023 · 2 comments
Open

Removing a comment #108

estahn opened this issue Aug 30, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@estahn
Copy link

estahn commented Aug 30, 2023

I run this as part of a CI pipeline and add a PR comment if there is a failure. I would like to remove the PR comment entirely if the steps succeed.

Maybe an attribute remove: true or similar.

@alex-inv
Copy link

Our use-case for add-pr-comment action is to add a comment to the PR if a specific label is missing. When the label is finally added, would be really nice if we could automatically remove the now obsolete comment 🙏

@mshick mshick added the enhancement New feature or request label Feb 1, 2024
@mshick mshick self-assigned this Feb 1, 2024
@mshick
Copy link
Owner

mshick commented Feb 1, 2024

I think this could actually be accomplished by a minor fix to the current behavior. If you only wanted a message to print when you have a failure, and you've set a message-failure override like below, then the action example here would actually cause an error:

      - uses: mshick/add-pr-comment@v2
        if: always()
        with:
          message-failure: |
            Uh oh!

What I might do instead is set the action to remove an existing message when no message input is found, rather than error out which I do now.

FWIW, maybe this functionality below is acceptable? You'd set your failure message, and it would be updated with a success message on the run that worked for you?

jobs:
  pr:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: mshick/add-pr-comment@v2
        if: always()
        with:
          message: |
            **Howdie!**
          message-failure: |
            Uh oh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

3 participants