prcomment v0.1.3
PRCOMMENT
Creates or updates single comment to Github PR or Issue.
Usage
First step is generate a new Github token in Github Settings.
Binaries
export GITHUB_TOKEN=<personal token>
prcomment -i 1 -r miry/prcomment Hello from console
Docker
docker run -e GITHUB_TOKEN=<token> --rm -it ghcr.io/miry/prcomment:0.1.3 -i 1 -r miry/prcomment Hello
Crystal
export GITHUB_TOKEN=<personal 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
steps:
-
uses: miry/prcomment@v0.1.3
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.
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:
crystal run src/cli.cr -- -i 1 -r miry/prcomment -m ":[+-]1:" "👍" # Creates a comment with icon: ':+1'
crystal run src/cli.cr -- -i 1 -r miry/prcomment -m ":[+-]1:" "👎" # Replaces with '👎'
The comment is too big for single line:
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"
Repository
prcomment
Owner
Statistic
- 2
- 0
- 1
- 0
- 0
- 9 months ago
- August 4, 2019
License
GNU Lesser General Public License v3.0
Links
Synced at
Sat, 21 Dec 2024 14:20:10 GMT
Languages