Last active
August 8, 2018 08:37
-
-
Save sridharavinash/4515e3bedd79d5fb4f2ffc6ab8bf704f to your computer and use it in GitHub Desktop.
Check Run API example using an installed GitHub App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"net/http" | |
"github.com/bradleyfalzon/ghinstallation" | |
"github.com/google/go-github/github" | |
) | |
func main() { | |
fmt.Println("Creating a check run...") | |
ctx := context.Background() | |
tr := http.DefaultTransport | |
itr, err := ghinstallation.NewKeyFromFile(tr, <app_id>, <integration_id>, "key.pem") | |
if err != nil { | |
panic(err) | |
} | |
client := github.NewClient(&http.Client{Transport: itr}) | |
opts := github.CreateCheckRunOptions{ | |
Name: "Mighty test check run", | |
HeadBranch: <your_branch_name>, | |
HeadSHA: <SHA_commit>, | |
Status: github.String("in_progress"), | |
} | |
ckrun, resp, err := client.Checks.CreateCheckRun(ctx, <owner>, <repo>, opts) | |
if err != nil { | |
panic(err) | |
} | |
fmt.Printf("%v\n%v\n", resp, ckrun) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment