@@ -21,20 +21,31 @@ main = do
21
21
callCommand " git fetch --tags"
22
22
tags <- filter (isPrefixOf " 0." ) . lines <$>
23
23
readProcess " git" [" tag" , " --list" , " --sort=v:refname" ] " "
24
- let lastTag = last tags
25
- messages <- lines <$>
26
- readProcess " git" [" log" , last tags <> " ..HEAD" , " --merges" , " --reverse" , " --pretty=format:\" %s\" " ] " "
24
+ messages <- lines <$> readProcess " git" [ " log" ,
25
+ , last tags <> " ..HEAD"
26
+ , " --merges"
27
+ , " --revers" ,
28
+ , " --pretty=format:\" %s\" "
29
+ ] " "
27
30
28
- let prNums = map (filter isDigit) $ map head $ filter (not . null ) $ map (filter (isPrefixOf " #" ) . words ) messages
31
+ let -- try to get "1334" out of "merge PR #1334"
32
+ prNums = map (filter isDigit) $
33
+ map head $
34
+ filter (not . null ) $
35
+ map (filter (isPrefixOf " #" ) . words ) messages
29
36
prUrls = map (" https://github.com/haskell/haskell-ide-engine/pull/" <> ) prNums
30
37
31
38
(flip mapM_ ) prUrls $ \ url -> do
32
39
body <- getResponseBody <$> httpLBS (parseRequest_ url)
33
40
let cursor = fromDocument (parseLBS body)
41
+
34
42
titles = (descendant >=> attributeIs " class" " js-issue-title" >=> child >=> content) cursor
35
43
title = T. unpack $ T. strip $ head titles
44
+
36
45
checkAuthor :: Element -> Bool
37
46
checkAuthor e = maybe False (T. isInfixOf " author" ) (M. lookup " class" (elementAttributes e))
38
47
authors = (descendant >=> checkElement checkAuthor >=> child >=> content) cursor
39
48
author = T. unpack $ T. strip $ authors !! 2 -- second author is the pr author
49
+
50
+ -- generate markdown
40
51
putStrLn $ " - [" <> title <> " ](" <> url <> " ) (@" <> author <> " )"
0 commit comments