|
1 |
| -# find-comment |
2 |
| -A GitHub action to find an issue or pull request comment |
| 1 | +# Find Comment |
| 2 | +[](https://github.com/marketplace/actions/find-comment) |
| 3 | + |
| 4 | +A GitHub action to find an issue or pull request comment. |
| 5 | + |
| 6 | +The action will output the comment ID of the first comment matching the search criteria. |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +### Find a comment containing the specified string |
| 11 | + |
| 12 | +```yml |
| 13 | + - name: Find Comment |
| 14 | + uses: peter-evans/find-comment@v1 |
| 15 | + id: fc |
| 16 | + with: |
| 17 | + issue-number: 1 |
| 18 | + body-includes: search string 1 |
| 19 | +``` |
| 20 | +
|
| 21 | +### Find a comment by the specified author |
| 22 | +
|
| 23 | +```yml |
| 24 | + - name: Find Comment |
| 25 | + uses: peter-evans/find-comment@v1 |
| 26 | + id: fc |
| 27 | + with: |
| 28 | + issue-number: 1 |
| 29 | + comment-author: peter-evans |
| 30 | +``` |
| 31 | +
|
| 32 | +### Find a comment containing the specified string AND by the specified author |
| 33 | +
|
| 34 | +```yml |
| 35 | + - name: Find Comment |
| 36 | + uses: peter-evans/find-comment@v1 |
| 37 | + id: fc |
| 38 | + with: |
| 39 | + issue-number: 1 |
| 40 | + comment-author: peter-evans |
| 41 | + body-includes: search string 1 |
| 42 | +``` |
| 43 | +
|
| 44 | +### Action inputs |
| 45 | +
|
| 46 | +| Name | Description | Default | |
| 47 | +| --- | --- | --- | |
| 48 | +| `token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). | `GITHUB_TOKEN` | |
| 49 | +| `repository` | The full name of the repository containing the issue or pull request. | Current repository | |
| 50 | +| `issue-number` | The number of the issue or pull request in which to search. | | |
| 51 | +| `comment-author` | The GitHub user name of the comment author. | | |
| 52 | +| `body-includes` | A string to search for in the body of comments. | | |
| 53 | + |
| 54 | +#### Outputs |
| 55 | + |
| 56 | +The ID of the first matching comment found will be output for use in later steps. |
| 57 | +Note that in order to read the step output the action step must have an id. |
| 58 | + |
| 59 | +```yml |
| 60 | + - name: Find Comment |
| 61 | + uses: peter-evans/find-comment@v1 |
| 62 | + id: fc |
| 63 | + with: |
| 64 | + issue-number: 1 |
| 65 | + body-includes: search string 1 |
| 66 | + - run: echo ${{ steps.fc.outputs.comment-id }} |
| 67 | +``` |
| 68 | + |
| 69 | +### Accessing issues and pull requests in other repositories |
| 70 | + |
| 71 | +You can search the comments of issues and pull requests in another repository by using a [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) instead of `GITHUB_TOKEN`. |
| 72 | + |
| 73 | +## License |
| 74 | + |
| 75 | +[MIT](LICENSE) |
0 commit comments