https://github.com/blimmer/create-or-update-pr-comment-demo
https://github.com/blimmer/create-or-update-pr-comment-demo
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/blimmer/create-or-update-pr-comment-demo
- Owner: blimmer
- Created: 2021-12-21T04:36:33.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-30T00:27:11.000Z (over 4 years ago)
- Last Synced: 2025-07-09T15:55:24.344Z (11 months ago)
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Create or Update PR Comment API Demo
Oftentimes, it's nice to have a bot user post some information to a Pull Request.
For example, imagine a link to a pre-production preview link for the branch,
or infrastructure-as-code diffs.
However, GitHub doesn't provide a simple way to "create or update" a comment for
a particular bot message. So, I built a simple serverless solution to work around
this using the GitHub API.
You can learn more about the backend implementation
[at benlimmer.com](https://benlimmer.com/2021/12/20/create-or-update-pr-comment/).
## Demo
To see this solution in action, check out
[the Demo Pull Request](https://github.com/blimmer/github-pr-comment-api-demo/pull/1).
As you'll see, the first time the API is called, a new comment is created. Then,
when the API is subsequently called, the existing comment will be updated.
By updating an existing comment, bot-based noise is significantly reduced, while
the history of each bot post is retained in the "edited" dropdown.

## Let's Connect!
I'm a freelance architect and engineer who loves focusing on Developer Experience
and tooling. Learn more at [benlimmer.com/freelance](https://benlimmer.com/freelance?utm_source=github&utm_campaign=create-or-update-pr-comment-demo).