Skip to content

Commit e83d413

Browse files
committed
Add support for auth github requests
As anonymous ones reach the api limit quickly Via a unique argument with a github oauth token
1 parent 85ef827 commit e83d413

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

GenChangelogs.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
#!/usr/bin/env cabal
22
{- cabal:
3-
build-depends: base, process, text, github, time >= 1.9
3+
build-depends: base, bytestring, process, text, github, time >= 1.9
44
-}
55

66
{-# LANGUAGE OverloadedStrings #-}
77
{-# LANGUAGE RecordWildCards #-}
88

99
import Control.Monad
10+
import qualified Data.ByteString.Char8 as BS
1011
import Data.List
1112
import Data.Maybe
1213
import qualified Data.Text as T
1314
import Data.Time.Format.ISO8601
1415
import Data.Time.LocalTime
1516
import GitHub
17+
import System.Environment
1618
import System.Process
1719

1820
main = do
@@ -23,7 +25,11 @@ main = do
2325
lastDateStr <- last . lines <$> readProcess "git" ["show", "-s", "--format=%cI", "-1", last tags] ""
2426
lastDate <- zonedTimeToUTC <$> iso8601ParseM lastDateStr
2527

26-
prs <- github' $ pullRequestsForR "haskell" "haskell-language-server" stateClosed FetchAll
28+
args <- getArgs
29+
let githubReq = case args of
30+
[] -> github'
31+
token:_ -> github (OAuth $ BS.pack token)
32+
prs <- githubReq $ pullRequestsForR "haskell" "haskell-language-server" stateClosed FetchAll
2733
let prsAfterLastTag = either (error . show)
2834
(foldMap (\pr -> [pr | inRange pr]))
2935
prs

0 commit comments

Comments
 (0)