-
Notifications
You must be signed in to change notification settings - Fork 196
Expand file tree
/
Copy pathCreateWebhook.hs
More file actions
24 lines (21 loc) · 873 Bytes
/
CreateWebhook.hs
File metadata and controls
24 lines (21 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module CreateWebhook where
import Github.Repos.Webhooks
import qualified Github.Auth as Auth
import Github.Data.Definitions
import qualified Data.Map as M
main :: IO ()
main = do
let auth = Auth.OAuth "oauthtoken"
let config = M.fromList [("url", "https://foo3.io"), ("content_type", "application/json"), ("insecure_ssl", "1")]
let webhookDef = NewRepoWebhook {
newRepoWebhookName = "web",
newRepoWebhookConfig = config,
newRepoWebhookEvents = Just [WebhookWildcardEvent],
newRepoWebhookActive = Just True
}
newWebhook <- createRepoWebhook' auth "repoOwner" "repoName" webhookDef
case newWebhook of
(Left err) -> putStrLn $ "Error: " ++ (show err)
(Right webhook) -> putStrLn $ formatRepoWebhook webhook
formatRepoWebhook :: RepoWebhook -> String
formatRepoWebhook (RepoWebhook _ _ _ name _ _ _ _ _ _) = show name