forked from haskell-github/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddOrUpdateTeamRepo.hs
More file actions
25 lines (22 loc) · 864 Bytes
/
AddOrUpdateTeamRepo.hs
File metadata and controls
25 lines (22 loc) · 864 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
25
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Common
import qualified GitHub
import qualified GitHub.Endpoints.Organizations.Teams as GitHub
main :: IO ()
main = do
args <- getArgs
result <- case args of
[token, team_id, org, repo] ->
GitHub.addOrUpdateTeamRepo'
(GitHub.OAuth $ fromString token)
(GitHub.mkTeamId $ read team_id)
(GitHub.mkOrganizationName $ fromString org)
(GitHub.mkRepoName $ fromString repo)
GitHub.PermissionPull
_ ->
error "usage: AddOrUpdateTeamRepo <token> <team_id> <org> <repo>"
case result of
Left err -> putStrLn $ "Error: " <> tshow err
Right team -> putStrLn $ tshow team