Code Monkey home page Code Monkey logo

find-comment's People

Contributors

0xcaso avatar actions-bot avatar amonshiz avatar danielhabenicht avatar dependabot[bot] avatar nilock avatar peter-evans avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

find-comment's Issues

nth comment match

Hi,
Would it be possible to add a parameter to get the nth comment that matches the search criteria? The use case I have in mind involves a tracker issue with multiple comments by the github-actions bot, where each comment corresponds to a different sub-topic and is automatically updated using the create-or-update-comment action. It would be nice to be able to, for example, get the third comment by the bot using a parameter instead of having to rely on string matches.

Find comment by id

Thank you for the wonderful action, it helps me a lot!
Currently I use it to fetch the body of a comment to be used in my workflow, but I find that I can't get the comment by comment id.
Would you please add the feature so that I can get a comment by comment id?

Dependabot finding

We have already the newest version of your action.
Dependabot finds the following dependencies in our repo:

image
Will these be fixed?

`Not found` error when using container

When using this action with this configuration:

name: Comment translation list
on: push

jobs:
  translations:
    runs-on: ubuntu-latest
    container:
      image: leviy/build-image
    steps:
      - name: Find comment with added translation keys
        uses: peter-evans/find-comment@v1
        id: findComment
        with:
          issue-number: ${{ github.event.pull_request.number }}
          comment-author: 'github-actions[bot]'
          body-includes: New added translation keys

We are using this docker image: https://hub.docker.com/r/leviy/build-image

It fails with this error:

Run peter-evans/find-comment@v1
/usr/bin/docker exec  b2e6705e275dc30ba9e27b1ee7700ff5c555983034fb2f2dd3fbfdad957083ac sh -c "cat /etc/*release | grep ^ID"
Error: Not Found

We don't have this with other actions, for example this one: necojackarc/auto-request-review

JSON5 vulnerability

Hi team,

Currently, we have the following vulnerability, can we look into fixing it?

[

  {
    "createdAt": "2023-02-02T17:50:38Z",
    "dismissedAt": null,
    "securityVulnerability": {
      "package": {
        "name": "json5"
      },
      "severity": "HIGH"
    }
  }
]

It is possible that #97 fixed it, but we need a new release

Find/Get the Pull Request description

Hi @peter-evans, I really like this action because how seamlessly it finds comments on other repositories.

Can this be enhanced to get the PR description/body?

If so, I would use your other action (Create or Update Comment) to update the PR description (would require you to update that one as well).

Please :)

[Testing Issue]

This is an issue used by this action's workflow test cases.

Find the last matching comment

The action will output the comment ID of the first comment matching the search criteria.

I'm wondering if it's possible to find the last comment?

`comment-author` cannot be printed at this case

Hi, I'm satisfied with this product.

However, when I was testing my github-action with your product, I found something strange.

After the several tests, I think maybe you didn't deal the case that comment-body contatins \n character for some reason

These are what I tested...

I used this code at Find Comment and Run echo step below

- name: Find Comment
      uses: peter-evans/[email protected]
      id: fc
      with:
          issue-number: 1
          body-includes: ${{ github.event.comment.body }}
    - run: |
        echo ${{ steps.fc.outputs.comment-id }}
        echo ${{ steps.fc.outputs.comment-body }}
        echo ${{ steps.fc.outputs.comment-author }}
  • When I posted an issue comment like (not includes \n)

    [질문] 개행아아아아
    

    -> get comment-author well

    image

  • When I posted an issue comment like (inclues \n)

    [질문]
    개행아아아아
    

    -> it occurs error 개행아아아아 commands not found. BUT, actually 개행아아아아 is not a command but a part of comment-body

    image

  • When I posted an issue comment like (not inclues \n, space)

    [질문]
    

    -> it occurs error \r command not found.

    image

GH warning: Node.js 16 actions are deprecated

When running the latest version of this action, github shows a warning:
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: peter-evans/find-comment@v2

The action should be updated to use a nodejs20 runner.

fetch body of matching comment

Hello @peter-evans , thanks for this very nice tool!

Is there a way of fetching the body of the matching comment? I.e., getting the body of a comment that matched the search keyword?

Thanks in advance!
Pedro

GITHUB_TOKEN permissions used by this action

At https://github.com/step-security/secure-workflows we are building a knowledge-base (KB) of GITHUB_TOKEN permissions needed by different GitHub Actions. When developers try to set minimum token permissions for their workflows, they can use this knowledge-base instead of trying to research permissions needed by each GitHub Action they use.

Below you can see the KB of your GITHUB Action.

name: 'Find Comment'
github-token:
  action-input:
    input: token
    is-default: true
  permissions:
    issues: read
    issues-reason: to get issue comment #Checkout: https://github.com/peter-evans/find-comment#accessing-issues-and-pull-requests-in-other-repositories
    pull-requests: read
    pull-requests-reason: to get PR comment

If you think this information is not accurate, or if in the future your GitHub Action starts using a different set of permissions, please create an issue at https://github.com/step-security/secure-workflows/issues to let us know.

This issue is automatically created by our analysis bot, feel free to close after reading :)

References:

GitHub asks users to define workflow permissions, see https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/ and https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token for securing GitHub workflows against supply-chain attacks.

Setting minimum token permissions is also checked for by Open Source Security Foundation (OpenSSF) Scorecards. Scorecards recommend using https://github.com/step-security/secure-workflows so developers can fix this issue in an easier manner.

Comment author "github-actions" not recognized as author

Hi

Thank you very much for this action - I just started to use it within a workflow. One thing I noticed is that "comment-author" for the author "github-actions" is not working.

My workflow starts like this:

on:
  issues:
    types: [closed]

jobs:
  close-activity:
    runs-on: ubuntu-latest
    steps:
    - name: Find Comment
      uses: peter-evans/[email protected]
      id: fc
      with:
        issue-number: ${{ github.event.issue.number }}
        comment-author: github-actions
        body-includes: Kimai activity created, ID-

My comment looks like this:
image

It works fine when i only use "body-includes" - but when I want to further restrict it to the author "github-actions" it's not working anymore. Any hints or thoughts from your end?

Always fails with error `Not Found`

Config

      - name: 🔎 Find Comment
        uses: peter-evans/find-comment@v2
        id: fc
        with:
          issue-number: ${{ github.event.pull_request.number }}
          body-includes: OctoDNS Plan

Error

Run peter-evans/find-comment@v2
  with:
    body-includes: OctoDNS Plan
    token: ***
    repository: xxx/yyy
    direction: first
    nth: 0
Error: Not Found

Troubleshooting

I've tried setting a token using GITHUB_TOKEN and a PAT, and not - nothing seems to work.

Output the comment's author

Thank you for creating this package!

For completeness, I think one of the outputs should be the comment-author. In my use case, I am trying to ensure that the most recent comment with some text is not a specific author (a bot, in my case). It's not clear whether this is possible to determine without outputting the comment author.

Example of my use case:

      - name: Find /deploy in PR (if applicable)
        uses: peter-evans/find-comment@v1
        if: ${{ github.event.client_payload.slash_command.args.named.pr_number }}
        id: fc
        with:
          issue-number: ${{ github.event.client_payload.slash_command.args.named.pr_number }}
          body-includes: /deploy
          direction: last

      - name: Check whether we need to deploy (/deploy, if applicable)
        if: ${{ github.event.client_payload.slash_command.args.named.pr_number }} && ${{ steps.fc.outputs.comment-id }} != 0 && ${{ steps.fc.outputs.comment-author }} != 'github-action[bot]'
        run: ...

Case insensitivity?

Hi - first of all thanks for this action/code.

I'm using it to...well, find a comment :) and I was trying to make the search case-insensitive.

In the regex, I've tried:

\^.*no-experiment.*$\gi << silently fails (no error, but doesn't find "no-experiment" or "no-experimenT")

(?i)^.*no-experiment.*$ << throws an error

The error from the second regex is:

Error: Invalid regular expression: /(?i)^.*no-experiment.*$/: Invalid group

So it seems that the regex start/end /.../ are being added when the regex is parsed, so I'm unable to add anything outside the regex start/end (no flags i.e. case insensitive).

Do you know of a way I can achieve above? Or I can also submit a PR to make the search for body-includes case insensitive if it wasn't intended to be case sensitive (is it?)

finding comment on a merged pull request

Hi @peter-evans ,

I am trying to find a comment located on a merged and closed pull request. Can I achieve this with find-comment? I tried something like shown below but it does not do the job.

 on:
   pull_request:
     types: [closed]
 env:
   TWEET_KEYWORD: '__[tweet]__'
 
 jobs:
   publish_tweet:
     runs-on: ubuntu-latest
     if: github.event.pull_request.merged
     steps:
     - name: find the tweet comment matching the keyword env.TWEET_KEYWORD
       uses: peter-evans/find-comment@v1
       id: fc
       with:
         issue-number: ${{ github.event.pull_request.number }}
         comment-author: github-actions[bot]
         body-includes: ${{ env.TWEET_KEYWORD }}

Workflow unable to find the issue

I have following steps in my workflow. Repeated runs of the workflow does NOT update the existing comment but always creates new comments.

Assumption based on docs body-includes matches if a part of the string matches.

      - name: Find Validation Comment
        uses: peter-evans/[email protected]
        id: fc
        with:
          issue-number: ${{ github.event.issue.number }}
          comment-author: github-actions
          body-includes: We have successfully validated your inputs

      - name: Validation comment
        uses: peter-evans/[email protected]
        with:
          issue-number: ${{ github.event.issue.number }}
          comment-id: ${{ steps.fc.outputs.comment-id }}
          body: |
            We have successfully validated your inputs and proceed with account creation…

Error: Not Found with PAT generated

I am trying to use this action in my private repo. I generated a PAT, added it to my GitHub repo -> action -> secret with the name TEST, and included the token in my .yaml file as follows:

name: TestPE
on: [workflow_dispatch, pull_request]
concurrency:
  group: pr-${{ github.event.pull_request.number }}
  cancel-in-progress: true
jobs:
  test_private_action_job:
    name: TestingPE
    runs-on: ubuntu-latest
    steps:
    - 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
        token: ${{ secrets.TEST }}

However, when I run the workflow, I receive Run peter-evans/find-comment@v2 Error: Not Found on the Find Comment step. Please let me know what I am doing wrong.

Support Regular Expressions

It would be great to be able to match comment bodies based on regex whereas right now this only works with containment. From briefly looking at the source code I think this might work by replacing references to string.includes with string.match. Happy to try and contribute this feature if there is interest.

Bot comments

I try to find comments by github-action bot but can't Receive empty outputs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.