Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miry/prcomment
Update or create a new comment to PR or Issue.
https://github.com/miry/prcomment
Last synced: about 4 hours ago
JSON representation
Update or create a new comment to PR or Issue.
- Host: GitHub
- URL: https://github.com/miry/prcomment
- Owner: miry
- License: lgpl-3.0
- Created: 2019-08-04T16:46:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-10T21:50:05.000Z (8 months ago)
- Last Synced: 2024-03-11T11:35:15.307Z (8 months ago)
- Language: Crystal
- Size: 41 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua/)
# PRCOMMENT
[![](https://img.shields.io/github/release/miry/prcomment.svg?style=flat)](https://github.com/miry/prcomment/releases)
[![](https://img.shields.io/github/license/miry/prcomment)](https://raw.githubusercontent.com/miry/prcomment/master/LICENSE)
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
[![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua)Creates or updates single comment to Github PR or Issue.
# Usage
First step is generate a new Github token in [Github Settings](https://github.com/settings/tokens/new?description=prcomment&scopes=public_repo).
## Binaries
```shell
export GITHUB_TOKEN=
prcomment -i 1 -r miry/prcomment Hello from console
```## Docker
```shell
docker run -e GITHUB_TOKEN= --rm -it ghcr.io/miry/prcomment:0.1.3 -i 1 -r miry/prcomment Hello
```## Crystal
```shell
export GITHUB_TOKEN=
crystal run src/cli.cr -- -i 1 -r miry/prcomment Hello
```## GithubAction
### Inputs
### msg
**Required** The msg of the comment. Default `"World"`.
### pr
**Optional** The PR or Issue ID where to add a comment. Default `github.event.pull_request.number`.
### match
**Optional** Pattern of the comment to be replaced with. Default `""`
### Examples
```yml
steps:
-
uses: miry/[email protected]
if: github.event_name == 'pull_request'
name: Comment
with:
msg: "Testing simple message from job ${{ github.run_id }}!"
match: 'Testing simple message from job .*'
pr: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
```# Options
## Match
One of the cases to have comment to show current test coverage.
By default, `prcomment` looks for first comment with same text.```shell
crystal run src/cli.cr -- -i 1 -r miry/prcomment -m "Test coverage \d*%" Test coverage 80% # Creates a comment with text: 'Test coverage 80%'
crystal run src/cli.cr -- -i 1 -r miry/prcomment -m "Test coverage \d*%" Test coverage 130% # Finds the comment and replaces with: 'Test coverage 130%'
```It is also usefull to change previous answer with new one:
```shell
crystal run src/cli.cr -- -i 1 -r miry/prcomment -m ":[+-]1:" ":+1:" # Creates a comment with icon: ':+1'
crystal run src/cli.cr -- -i 1 -r miry/prcomment -m ":[+-]1:" ":-1:" # Replaces with ':-1:'
```The comment is too big for single line:
```shell
echo "The big content could be piped\nSome pattern from the comment\nThird line" | \
crystal run src/cli.cr -- -i 1 -r miry/prcomment -m "Some pattern from the comment"
```