mirror of
https://github.com/peter-evans/create-or-update-comment.git
synced 2025-01-18 19:22:44 +08:00
Peter Evans
7d1077e7f9
Merge pull request #8 from peter-evans/renovate/zeit-ncc-0.x
Update dependency @zeit/ncc to v0.21.1
Create or Update Comment
A GitHub action to create or update an issue or pull request comment.
This action was created to help facilitate a GitHub Actions "ChatOps" solution in conjunction with slash-command-dispatch action.
Usage
Add a comment to an issue or pull request
- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: 1
body: |
This is a multi-line test comment
- With GitHub **Markdown**
- Created by [create-or-update-comment][1]
[1]: https://github.com/peter-evans/create-or-update-comment
reaction-type: '+1'
Update a comment
- name: Update comment
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: 557858210
body: |
**Edit:** Some additional info
reaction-type: eyes
Add a comment reaction
- name: Add reaction
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: 557858210
reaction-type: heart
Action inputs
Name | Description | Default |
---|---|---|
token |
GITHUB_TOKEN or a repo scoped PAT. |
|
repository |
The full name of the repository in which to create or update a comment. | Current repository |
issue-number |
The number of the issue or pull request in which to create a comment. | |
comment-id |
The id of the comment to update. | |
body |
The comment body. | |
edit-mode |
The mode when updating a comment, replace or append . |
append |
reaction-type |
The reaction to add to the comment. (+1 , -1 , laugh , confused , heart , hooray , rocket , eyes ) |
Where to find the id of a comment
How to find the id of a comment will depend a lot on the use case.
Here is one example where the id can be found in the github
context during an issue_comment
event.
on:
issue_comment:
types: [created]
jobs:
commentCreated:
runs-on: ubuntu-latest
steps:
- name: Add reaction
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.comment.id }}
reaction-type: eyes
Accessing issues and comments in other repositories
You can create and update comments in another repository by using a PAT instead of GITHUB_TOKEN
.
The user associated with the PAT must have write access to the repository.
License
Languages
TypeScript
97.7%
JavaScript
2.3%