A simple bot to comment on PR and issue written in Go
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.ci
comment
examples
template
Dockerfile
LICENSE
README.md
main.go

README.md

Kuttlefish

GitHub license Go Report Card

A simple bot to comment on PR and issue written in Go

Why?

Because it's very useful for CI reports.

Installation

Using sources

Install Golang, clone the repository and build:

$ git clone https://github.com/alexandrebouthinon/kuttlefish
$ cd kuttlefish
$ go build

Using go get

If you have a fully configured Golang environment, set up and add your GOBIN to your PATH. Finally, just run:

$ go get github.com/alexandrebouthinon/kuttlefish
$ go install github.com/alexandrebouthinon/kuttlefish

Usage

It's easy, put your variables in a JSON file and create your custom HTML template using Go syntax:

  • JSON data file example:
{
  "title": "A HTML formated title",
  "content": "A very long content containing a lot of stuff"
}
  • HTML template file example:
<h2>{{index . "title"}}</h2>
<p>{{index . "content"}}</p>

Now you can use Kuttlefish following help guide:

$  kuttlefish -help
                  _  __    _   _   _      __ _    _
                 | |/ /  _| |_| |_| |___ / _(_)__| |_
                 | ' < || |  _|  _| / -_)  _| (_-< ' \
                 |_|\_\_,_|\__|\__|_\___|_| |_/__/_||_|

  -data string
        JSON file containing template value (Required)
  -id int
        PR or Issue number (Required) (default -1)
  -owner string
        Target repository owner (Required)
  -repo string
        Target Repository name (Required)
  -template string
        Template file containing variables to fill with data from JSON file (Required)
  -token string
        Github API Token (Required)

For example, if I want to comment issue numbered 26 on this repository using template and values files from examples directory:

$ kuttlefish -template examples/index.html -data examples/data.json -repo kuttlefish -owner alexandrebouthinon -id 26 -token 25e8690dfb3a55ed4b61e4303ea127ebc0741275

Comment looks like this:

Kuttlefish comment example

Docker image

If you don't want to install Golang, you can use the Docker image. It's the recommended way to use Kuttlefish when you want to use it in your CI system

  • Pull the image
$ docker pull alexandrebouthinon/kuttlefish
  • Use it:
docker run --rm -it -v /absolute/path/to/template/and/json/directory:/mnt alexandrebouthinon/kuttlefish kuttlefish \
        -template /mnt/index.html \
        -data /mnt/data.json \
        -repo kuttlefish \
        -owner alexandrebouthinon \
        -token 25e8690dfb3a55ed4b61e4303ea127ebc0741275 \
        -id 26

Author

Alexandre BOUTHINON - @alexandrebouthinon

MIT LICENSE