forked from haskell-github/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchIssues.hs
More file actions
26 lines (23 loc) · 931 Bytes
/
SearchIssues.hs
File metadata and controls
26 lines (23 loc) · 931 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
26
{-# LANGUAGE OverloadedStrings #-}
module SearchIssues where
import qualified Github.Search as Github
import Control.Monad (forM_)
main = do
let query = "q=build%20repo%3Aphadej%2Fgithub&per_page=100"
let auth = Nothing
result <- Github.searchIssues' auth query
case result of
Left e -> putStrLn $ "Error: " ++ show e
Right r -> do forM_ (Github.searchIssuesIssues r) (\i -> do
putStrLn $ formatIssue i
putStrLn ""
)
putStrLn $ "Count: " ++ show n ++ " build issues"
where n = Github.searchIssuesTotalCount r
formatIssue issue =
(Github.githubOwnerLogin $ Github.issueUser issue) ++
" opened this issue " ++
(show $ Github.fromDate $ Github.issueCreatedAt issue) ++ "\n" ++
(Github.issueState issue) ++ " with " ++
(show $ Github.issueComments issue) ++ " comments" ++ "\n\n" ++
(Github.issueTitle issue)