actions-comment-pull-request icon indicating copy to clipboard operation
actions-comment-pull-request copied to clipboard

Change `comment_includes` to be automatic

Open lukasz-mitka opened this issue 2 years ago • 1 comments

Improvement idea: switch from comment_includes to comment_tag

If message body had something like this appended <!--- thollander/actions-comment-pull-request "comment_tag" ---> it would be easy to precisely select comment for editing and wouldn't be visible to user.

Benefits:

  • independent of message body
  • no false-positive matches
  • not displayed to user

lukasz-mitka avatar Oct 10 '22 13:10 lukasz-mitka

@thollander Could this be done?

There is also this to avoid two results for the same string search: https://stackoverflow.com/a/70566764/20234776

ftzi avatar Nov 17 '22 22:11 ftzi

Thanks for the improvement idea ! Why can't you use the comment_includes parameter to do so ? It has the benefit to be generic and you can put whatever you want as comment pattern.

Example here : https://github.com/thollander/actions-comment-pull-request/pull/156/files

          message: |
            Current branch is `${{ github.head_ref }}`.
            _(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
            <!--- thollander/actions-comment-pull-request "comment_tag" --->
          comment_includes: <!--- thollander/actions-comment-pull-request "comment_tag" --->

Would it match to your need ?

thollander avatar Nov 28 '22 17:11 thollander

I believe this is just extra learning and writing requirement for us, the users, besides being hard to explain to others what is that. It should and could be more plug n' play

ftzi avatar Nov 28 '22 19:11 ftzi

@thollander Solution you proposed requires code duplication and complexity that could be hidden behind implementation. See how much simpler this looks and how less error prone it is:

          message: |
            Current branch is `${{ github.head_ref }}`.
            _(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
          comment_tag: current-branch

lukasz-mitka avatar Nov 29 '22 10:11 lukasz-mitka