diff --git a/bot/.gitignore b/bot/.gitignore deleted file mode 100644 index cfaad76..0000000 --- a/bot/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.pem diff --git a/bot/utils.go b/bot/utils.go index 4f56689..74b617c 100644 --- a/bot/utils.go +++ b/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,6 +22,13 @@ 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() {