thollander / actions-comment-pull-request

GitHub action to comment pull request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change `comment_includes` to be automatic

lukasz-mitka opened this issue · 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
commented

@thollander Could this be done?

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

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 ?

commented

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

@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