-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Feature request: Delete prior comment and add new #110
Comments
Hi @selfagency I'm not sure about adding that functionality into this action itself, but what you want to do is very easy to achieve anyway with one extra workflow step to delete the comment. Change this to suit your use case, but something like this should work. - name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Build output
- if: steps.fc.outputs.comment-id != ''
uses: actions/github-script@v6
with:
script: |
github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ steps.fc.outputs.comment-id }}
})
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Build output
${{ steps.build.outputs.build-log }} |
@peter-evans Thanks |
Hello @peter-evans. Your GitHub action is awesome. |
I'm not aware of any easy way to do that. I think you'll need to do something similar to the example above, but inside the |
Thank you so much for making this extremely useful Action. It's been immensely helpful for my workflows. In my use case, I publish unit and E2E test results as comments to my team's PRs. However, I've noticed sometimes on PRs with a lot of commits or lengthy discussions that, due to their age, the comments produced using this Action get buried behind the following separator, and so when they are updated, those updates get lost.
I was hoping you might consider adding a feature that, instead of updating the previous comment, will delete it and add a new comment entirely so that the latest updates always appear on screen.
Thank you!
The text was updated successfully, but these errors were encountered: