commit
0026b57e23
2 changed files with 11 additions and 3 deletions
1
bot/.gitignore
vendored
1
bot/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
*.pem
|
13
bot/utils.go
13
bot/utils.go
|
@ -7,12 +7,14 @@ import (
|
|||
"golang.org/x/net/context"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Wrap the shared transport for use with the integration ID and authenticating with installation ID.
|
||||
var itr, _ = ghinstallation.NewKeyFromFile(http.DefaultTransport, 381312, 41105280, "theopenestsource.2023-08-26.private-key.pem")
|
||||
var privateKey = os.Getenv("privateKey")
|
||||
var itr, _ = ghinstallation.NewKeyFromFile(http.DefaultTransport, 381312, 41105280, privateKey)
|
||||
|
||||
// Use installation transport with client.
|
||||
var client = github.NewClient(&http.Client{Transport: itr})
|
||||
|
@ -20,10 +22,17 @@ var ctx = context.Background()
|
|||
|
||||
func initGitHubClient() {
|
||||
log.Println("Initializing......")
|
||||
|
||||
if privateKey != "" {
|
||||
log.Println(privateKey)
|
||||
} else {
|
||||
log.Println("Private key not found!")
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
func listenForWebhook() {
|
||||
log.Println("Listening on :3333......")
|
||||
log.Println("Listening on :433......")
|
||||
|
||||
http.HandleFunc("/", webHandle)
|
||||
http.HandleFunc("/webhook", webhookHandler)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue