Open ViacheslavKudinov opened 6 months ago
Noticed same behavior as well ..
I think we are having the same (or similar) problem. I'd like to just be able to delete comments that have the specified comment_tag
. It would be nice if this snippet would just delete the comment if it existed.
- name: Delete comment if exists
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: 'some_tag'
mode: delete
Currently we get an error because either filePath
or message
is required by the action:
Error: Either "filePath" or "message" should be provided as input
To me, the current delete
mode is more like a delete-on-completion
mode. But for the sake of backwards compatibility, it might make sense to add a only-delete
option which just does:
+++ b/src/main.ts
@@ -157,6 +157,12 @@ async function run() {
body,
});
return;
+ } else if (mode === 'only-delete') {
+ await deleteComment({
+ ...context.repo,
+ comment_id: comment.id,
+ });
+ return;
} else if (mode === 'delete') {
core.debug('Registering this comment to be deleted.');
Here's a proof of concept with no backwards compatibility issues: https://github.com/iFixit/actions-comment-pull-request/compare/main...iFixit:actions-comment-pull-request:add-only-delete
I can open a PR if you'd like.
Hello, i have the situation when i change
mode
dynamically based on the result of another step, but ondelete
mode extra comment will be temporarily added all the time due to current logic.I use this Action to add comment on PR in case if TFLinter finds some concerns based on exit code. When TFLinter finds concern, the Action adds comment as it runs based on