Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keisukeyamashita/create-comment
📋 GitHub Action that post comment on a GitHub Issue or Pull Request
https://github.com/keisukeyamashita/create-comment
github-actions utility
Last synced: 4 months ago
JSON representation
📋 GitHub Action that post comment on a GitHub Issue or Pull Request
- Host: GitHub
- URL: https://github.com/keisukeyamashita/create-comment
- Owner: KeisukeYamashita
- License: mit
- Created: 2020-10-28T06:24:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-23T21:08:36.000Z (about 2 years ago)
- Last Synced: 2024-10-26T10:38:14.356Z (4 months ago)
- Topics: github-actions, utility
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/create-comment
- Size: 690 KB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Create Comment
[](https://github.com/KeisukeYamashita/create-comment/actions?query=workflow%3Abuild-test)
[](https://github.com/marketplace/actions/create-comment)A GitHub Action that post comment on a GitHub Issue or Pull Request.
If the same content is posted before, this action will delete the existing one and post a new one.This action extract the number from an issue or a pull request which has triggered this by default. You don't need to specify the issue number by `${{ github.event.issue.number }}` or `${{ github.event.pull_request.number }}` if you want to post to its issue or pull request.
## Usage
```yml
- name: Create Comment
uses: KeisukeYamashita/create-comment@v1
with:
number: 1
comment: Comment for Issue or GitHub Pull Request
```### Post a comment and close the previous same comment
This is just an example to show one way in which this action can be used.
```yml
on: pull_request
jobs:
commit-message-check:
runs-on: ubuntu-latest
steps:
- name: Post comment
uses: KeisukeYamashita/create-comment@v1
with:
comment: |
Issue title must start with 'ABC-'.
Auto-closing this issue.
```### Action inputs
| Name | Description | Default |
| --- | --- | --- |
| `check-only-first-line` | If `true`, If the first line is same, it is considered to be the same post. It works when `unique` is `true`. | `false` |
| `comment` | Comment to post. | - (Required) |
| `unique` | If `true`, existing comment with same body will be deleted. | `true` |
| `number` | The number of the issue to post. | `github.event.issue.number` |
| `repository` | The GitHub repository containing the issue or pr. | Current repository |
| `token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |### Action outputs
| Name | Description |
| --- | --- |
| `deleted-comment` | If there was existing same comments or not that was deleted |
| `deleted-comment-id` | The deleted comment ID |
| `comment-id` | The posted comment ID |
| `match-first-line` | If match first line or not |### Accessing issues in other repositories
You can close issues in another repository by using a [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) instead of `GITHUB_TOKEN`.
The user associated with the PAT must have write access to the repository.## Acknowledgement
I've derived the design for this action from @peter-evans's GitHub Actions.
Thanks to @perter-evans and the contributors for all the hard work and sharing it as an opensource project.## License
[MIT](LICENSE)