From a70721b5e90ec9bb2a7b1b20771c0db10b988709 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Tue, 26 Nov 2019 12:55:10 +0100 Subject: [PATCH 001/121] Remove redundant withOpenSSL Unless it was intentional? I didn't find anything about double application in its documentation. --- src/GitHub/Request.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index 04d13c6d..dee15fb8 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -129,7 +129,7 @@ executeRequest => am -> GenRequest mt rw a -> IO (Either Error a) -executeRequest auth req = withOpenSSL $ withOpenSSL $ do +executeRequest auth req = withOpenSSL $ do manager <- newManager tlsManagerSettings executeRequestWithMgr manager auth req From a04cba6b0e3ff113a0c4c6d655b78ee9a7bd11fc Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Wed, 27 Nov 2019 03:30:59 +0200 Subject: [PATCH 002/121] Re-export deploy keys from GitHub module --- src/GitHub.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/GitHub.hs b/src/GitHub.hs index f847e45d..321c5de7 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -283,6 +283,13 @@ module GitHub ( commitR, diffR, + -- ** Deploy Keys + -- | See + deployKeysForR, + deployKeyForR, + createRepoDeployKeyR, + deleteRepoDeployKeyR, + -- ** Deployments -- | See -- @@ -419,6 +426,7 @@ import GitHub.Endpoints.Repos import GitHub.Endpoints.Repos.Collaborators import GitHub.Endpoints.Repos.Comments import GitHub.Endpoints.Repos.Commits +import GitHub.Endpoints.Repos.DeployKeys import GitHub.Endpoints.Repos.Deployments import GitHub.Endpoints.Repos.Forks import GitHub.Endpoints.Repos.Invitations From 299507c7450305defd14ce3e3204c19df96276e3 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Tue, 26 Nov 2019 19:23:38 +0200 Subject: [PATCH 003/121] Add github and github' convinience functions --- README.md | 7 ++-- github.cabal | 2 +- src/GitHub.hs | 10 ++++-- src/GitHub/Request.hs | 76 +++++++++++++++++++++++++++++++++++++++---- 4 files changed, 83 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 9136e437..877c51dc 100644 --- a/README.md +++ b/README.md @@ -63,11 +63,12 @@ import Data.Text (Text, pack) import Data.Text.IO as T (putStrLn) import Data.Monoid ((<>)) -import qualified GitHub.Endpoints.Users.Followers as GitHub +import GitHub (github') +import qualified GitHub main :: IO () main = do - possibleUsers <- GitHub.usersFollowing "mike-burns" + possibleUsers <- github GitHub.usersFollowingR "phadej" T.putStrLn $ either (("Error: " <>) . pack . show) (foldMap ((<> "\n") . formatUser)) possibleUsers @@ -98,7 +99,7 @@ Copyright Copyright 2011-2012 Mike Burns. Copyright 2013-2015 John Wiegley. -Copyright 2016 Oleg Grenrus. +Copyright 2016-2019 Oleg Grenrus. Available under the BSD 3-clause license. diff --git a/github.cabal b/github.cabal index 33df9fe2..ff5c3c2a 100644 --- a/github.cabal +++ b/github.cabal @@ -15,7 +15,7 @@ description: > > main :: IO () > main = do - > possibleUser <- GH.executeRequest' $ GH.userInfoForR "phadej" + > possibleUser <- GH.github' GH.userInfoForR "phadej" > print possibleUser . For more of an overview please see the README: diff --git a/src/GitHub.hs b/src/GitHub.hs index 321c5de7..ab660395 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -6,11 +6,17 @@ -- This module re-exports all request constructrors and data definitions from -- this package. -- --- See "GitHub.Request" module for executing 'Request', or other modules --- of this package (e.g. "GitHub.Endpoints.Users") for already composed versions. +-- See "GitHub.Request" module for executing 'Request', in short +-- use @'github' request@, for example +-- +-- @ +-- 'github' 'userInfoForR' +-- :: 'AuthMethod' am => am -> 'Name' 'User' -> IO (Either 'Error' 'User') +-- @ -- -- The missing endpoints lists show which endpoints we know are missing, there -- might be more. +-- module GitHub ( -- * Activity -- | See diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index dee15fb8..83eba89b 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -1,9 +1,11 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- | -- License : BSD-3-Clause @@ -29,6 +31,11 @@ -- > githubRequest :: GH.Request 'False a -> GithubMonad a -- > githubRequest = singleton module GitHub.Request ( + -- * A convinient execution of requests + github, + github', + GitHubRW, + GitHubRO, -- * Types Request, GenRequest (..), @@ -107,6 +114,63 @@ import GitHub.Data.Request import Paths_github (version) +------------------------------------------------------------------------------- +-- Convinience +------------------------------------------------------------------------------- + +-- | A convinience function to turn functions returning @'Request' rw x@, +-- into functions returning @IO (Either 'Error' x)@. +-- +-- >>> :t \auth -> github auth userInfoForR +-- \auth -> github auth userInfoForR +-- :: AuthMethod am => am -> Name User -> IO (Either Error User) +-- +-- >>> :t github pullRequestsForR +-- \auth -> github auth pullRequestsForR +-- :: AuthMethod am => +-- am +-- -> Name Owner +-- -> Name Repo +-- -> PullRequestMod +-- -> FetchCount +-- -> IO (Either Error (Data.Vector.Vector SimplePullRequest)) +-- +github :: (AuthMethod am, GitHubRW req res) => am -> req -> res +github = githubImpl + +-- | Like 'github'' but for 'RO' i.e. read-only requests. +-- Note that GitHub has low request limit for non-authenticated requests. +-- +-- >>> :t github' userInfoForR +-- github' userInfoForR :: Name User -> IO (Either Error User) +-- +github' :: GitHubRO req res => req -> res +github' = githubImpl' + +-- | A type-class implementing 'github'. +class GitHubRW req res | req -> res where + githubImpl :: AuthMethod am => am -> req -> res + +-- | A type-class implementing 'github''. +class GitHubRO req res | req -> res where + githubImpl' :: req -> res + +instance (ParseResponse mt req, res ~ Either Error req) => GitHubRW (GenRequest mt rw req) (IO res) where + githubImpl = executeRequest + +instance (ParseResponse mt req, res ~ Either Error req, rw ~ 'RO) => GitHubRO (GenRequest mt rw req) (IO res) where + githubImpl' = executeRequest' + +instance GitHubRW req res => GitHubRW (a -> req) (a -> res) where + githubImpl am req x = githubImpl am (req x) + +instance GitHubRO req res => GitHubRO (a -> req) (a -> res) where + githubImpl' req x = githubImpl' (req x) + +------------------------------------------------------------------------------- +-- Execution +------------------------------------------------------------------------------- + #ifdef MIN_VERSION_http_client_tls withOpenSSL :: IO a -> IO a withOpenSSL = id From 75fa30bfd14599ba09031ad63215d14e7a239d3d Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Wed, 27 Nov 2019 02:26:42 +0200 Subject: [PATCH 004/121] Remove precomposed executeRequest functions Users are adviced to use `github` combinator. This change allows to remove more than a half of symbols, which can be recovered by a single combinator. This makes library at lot slickier. --- samples/RateLimit.hs | 1 - samples/Repos/DeployKeys/CreateDeployKey.hs | 16 +- samples/Repos/DeployKeys/ListDeployKeys.hs | 12 +- samples/Repos/ShowRepo.hs | 19 +- samples/Teams/EditTeam.hs | 4 +- samples/Teams/ListRepos.hs | 7 +- samples/Teams/ListTeamsCurrent.hs | 5 +- .../Teams/Memberships/AddTeamMembershipFor.hs | 16 +- samples/Teams/TeamInfoFor.hs | 7 +- samples/Users/ShowUser.hs | 45 ++-- samples/github-samples.cabal | 122 +++++------ spec/GitHub/ActivitySpec.hs | 1 - spec/GitHub/CommitsSpec.hs | 20 +- spec/GitHub/OrganizationsSpec.hs | 9 +- spec/GitHub/PublicSSHKeysSpec.hs | 11 +- spec/GitHub/ReleasesSpec.hs | 1 - spec/GitHub/ReposSpec.hs | 20 +- spec/GitHub/SearchSpec.hs | 5 +- spec/GitHub/UsersSpec.hs | 22 +- src/GitHub.hs | 9 - .../Endpoints/Activity/Notifications.hs | 19 +- src/GitHub/Endpoints/Activity/Starring.hs | 40 ---- src/GitHub/Endpoints/Activity/Watching.hs | 33 --- src/GitHub/Endpoints/Gists.hs | 52 ----- src/GitHub/Endpoints/Gists/Comments.hs | 17 -- src/GitHub/Endpoints/GitData/Blobs.hs | 17 -- src/GitHub/Endpoints/GitData/Commits.hs | 10 - src/GitHub/Endpoints/GitData/References.hs | 48 +---- src/GitHub/Endpoints/GitData/Trees.hs | 31 --- src/GitHub/Endpoints/Issues.hs | 56 ----- src/GitHub/Endpoints/Issues/Comments.hs | 53 ----- src/GitHub/Endpoints/Issues/Events.hs | 46 ----- src/GitHub/Endpoints/Issues/Labels.hs | 135 ------------ src/GitHub/Endpoints/Issues/Milestones.hs | 36 ---- src/GitHub/Endpoints/Organizations.hs | 30 --- src/GitHub/Endpoints/Organizations/Members.hs | 35 ---- src/GitHub/Endpoints/Organizations/Teams.hs | 127 ------------ src/GitHub/Endpoints/PullRequests.hs | 125 ----------- src/GitHub/Endpoints/PullRequests/Comments.hs | 27 --- src/GitHub/Endpoints/PullRequests/Reviews.hs | 88 -------- src/GitHub/Endpoints/RateLimit.hs | 14 -- src/GitHub/Endpoints/Repos.hs | 194 ------------------ src/GitHub/Endpoints/Repos/Collaborators.hs | 40 ---- src/GitHub/Endpoints/Repos/Comments.hs | 48 ----- src/GitHub/Endpoints/Repos/Commits.hs | 63 ------ src/GitHub/Endpoints/Repos/Contents.hs | 82 -------- src/GitHub/Endpoints/Repos/DeployKeys.hs | 24 --- src/GitHub/Endpoints/Repos/Forks.hs | 17 -- src/GitHub/Endpoints/Repos/Releases.hs | 61 ------ src/GitHub/Endpoints/Repos/Statuses.hs | 29 --- src/GitHub/Endpoints/Repos/Webhooks.hs | 38 ---- src/GitHub/Endpoints/Search.hs | 49 ----- src/GitHub/Endpoints/Users.hs | 32 +-- src/GitHub/Endpoints/Users/Emails.hs | 17 -- src/GitHub/Endpoints/Users/Followers.hs | 17 -- src/GitHub/Endpoints/Users/PublicSSHKeys.hs | 30 --- 56 files changed, 177 insertions(+), 1955 deletions(-) diff --git a/samples/RateLimit.hs b/samples/RateLimit.hs index c0cabd5f..399fd925 100644 --- a/samples/RateLimit.hs +++ b/samples/RateLimit.hs @@ -5,4 +5,3 @@ import qualified Github.RateLimit as Github main = do x <- Github.rateLimit print x - diff --git a/samples/Repos/DeployKeys/CreateDeployKey.hs b/samples/Repos/DeployKeys/CreateDeployKey.hs index f95f3079..953e299a 100644 --- a/samples/Repos/DeployKeys/CreateDeployKey.hs +++ b/samples/Repos/DeployKeys/CreateDeployKey.hs @@ -1,21 +1,19 @@ {-# LANGUAGE OverloadedStrings #-} module Main (main) where -import qualified GitHub.Data.DeployKeys as DK -import qualified GitHub.Endpoints.Repos.DeployKeys as DK -import qualified GitHub.Auth as Auth +import qualified GitHub as GH import Data.Text (Text) main :: IO () main = do - let auth = Auth.OAuth "auth_token" - eDeployKey <- DK.createRepoDeployKey' auth "your_owner" "your_repo" newDeployKey + let auth = GH.OAuth "auth_token" + eDeployKey <- GH.github auth GH.createRepoDeployKeyR "your_owner" "your_repo" newDeployKey case eDeployKey of - (Left err) -> putStrLn $ "Error: " ++ (show err) - (Right deployKey) -> putStrLn $ show deployKey + Left err -> putStrLn $ "Error: " ++ show err + Right deployKey -> print deployKey -newDeployKey :: DK.NewRepoDeployKey -newDeployKey = DK.NewRepoDeployKey publicKey "test-key" True +newDeployKey :: GH.NewRepoDeployKey +newDeployKey = GH.NewRepoDeployKey publicKey "test-key" True where publicKey :: Text publicKey = "your_public_key" diff --git a/samples/Repos/DeployKeys/ListDeployKeys.hs b/samples/Repos/DeployKeys/ListDeployKeys.hs index bde0b665..070eb297 100644 --- a/samples/Repos/DeployKeys/ListDeployKeys.hs +++ b/samples/Repos/DeployKeys/ListDeployKeys.hs @@ -1,19 +1,17 @@ {-# LANGUAGE OverloadedStrings #-} module Main (main) where -import qualified GitHub.Data.DeployKeys as DK -import qualified GitHub.Endpoints.Repos.DeployKeys as DK -import qualified GitHub.Auth as Auth +import qualified GitHub as GH import Data.List (intercalate) import Data.Vector (toList) main :: IO () main = do - let auth = Auth.OAuth "auth_token" - eDeployKeys <- DK.deployKeysFor' auth "your_owner" "your_repo" + let auth = GH.OAuth "auth_token" + eDeployKeys <- GH.github auth GH.deployKeysForR "your_owner" "your_repo" GH.FetchAll case eDeployKeys of - (Left err) -> putStrLn $ "Error: " ++ (show err) - (Right deployKeys) -> putStrLn $ intercalate "\n" $ map formatRepoDeployKey (toList deployKeys) + Left err -> putStrLn $ "Error: " ++ show err + Right deployKeys -> putStrLn $ intercalate "\n" $ map formatRepoDeployKey (toList deployKeys) formatRepoDeployKey :: DK.RepoDeployKey -> String formatRepoDeployKey = show diff --git a/samples/Repos/ShowRepo.hs b/samples/Repos/ShowRepo.hs index 5007cfdc..ac72069a 100644 --- a/samples/Repos/ShowRepo.hs +++ b/samples/Repos/ShowRepo.hs @@ -7,18 +7,17 @@ import Data.Maybe main = do possibleRepo <- Github.repository "mike-burns" "trylambda" case possibleRepo of - (Left error) -> putStrLn $ "Error: " ++ (show error) - (Right repo) -> putStrLn $ formatRepo repo + Left error -> putStrLn $ "Error: " ++ show error + Right repo -> putStrLn $ formatRepo repo -formatRepo repo = - (Github.repoName repo) ++ "\t" ++ - (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ - (Github.repoHtmlUrl repo) ++ "\n" ++ - (fromMaybe "" $ Github.repoCloneUrl repo) ++ "\t" ++ - (fromMaybe "" $ formatDate `fmap` Github.repoUpdatedAt repo) ++ "\n" ++ +formatRepo repo = Github.repoName repo ++ "\t" ++ + fromMaybe "" (Github.repoDescription repo) ++ "\n" ++ + Github.repoHtmlUrl repo ++ "\n" ++ + fromMaybe "" (Github.repoCloneUrl repo) ++ "\t" ++ + maybe "" formatDate (Github.repoUpdatedAt repo) ++ "\n" ++ formatLanguage (Github.repoLanguage repo) ++ - "watchers: " ++ (show $ Github.repoWatchers repo) ++ "\t" ++ - "forks: " ++ (show $ Github.repoForks repo) + "watchers: " ++ show (Github.repoWatchers repo) ++ "\t" ++ + "forks: " ++ show (Github.repoForks repo) formatDate = show . Github.fromDate diff --git a/samples/Teams/EditTeam.hs b/samples/Teams/EditTeam.hs index 7e3f63a1..bb0a05ca 100644 --- a/samples/Teams/EditTeam.hs +++ b/samples/Teams/EditTeam.hs @@ -5,15 +5,15 @@ 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, team_name, desc] -> - GitHub.editTeam' + GitHub.github (GitHub.OAuth $ fromString token) + GitHub.editTeamR (GitHub.mkTeamId $ read team_id) (GitHub.EditTeam (GitHub.mkTeamName $ fromString team_name) (Just $ fromString desc) GitHub.PermissionPull) _ -> diff --git a/samples/Teams/ListRepos.hs b/samples/Teams/ListRepos.hs index 505f4c7b..a03dc143 100644 --- a/samples/Teams/ListRepos.hs +++ b/samples/Teams/ListRepos.hs @@ -4,15 +4,14 @@ module Main (main) where import Common import Prelude () -import qualified GitHub -import qualified GitHub.Endpoints.Organizations.Teams as GitHub +import qualified GitHub as GH main :: IO () main = do args <- getArgs possibleRepos <- case args of - [team_id, token] -> GitHub.listTeamRepos' (Just $ GitHub.OAuth $ fromString token) (GitHub.mkTeamId $ read team_id) - [team_id] -> GitHub.listTeamRepos (GitHub.mkTeamId $ read team_id) + [team_id, token] -> GH.github (GH.OAuth $ fromString token) GH.listTeamReposR (GH.mkTeamId $ read team_id) + [team_id] -> GH.github' GH.listTeamReposR (GH.mkTeamId $ read team_id) _ -> error "usage: TeamListRepos [auth token]" case possibleRepos of Left err -> putStrLn $ "Error: " <> tshow err diff --git a/samples/Teams/ListTeamsCurrent.hs b/samples/Teams/ListTeamsCurrent.hs index 4e75aa6a..eefd1e70 100644 --- a/samples/Teams/ListTeamsCurrent.hs +++ b/samples/Teams/ListTeamsCurrent.hs @@ -4,14 +4,13 @@ module Main (main) where import Common -import qualified GitHub -import qualified GitHub.Endpoints.Organizations.Teams as GitHub +import qualified GitHub as GH main :: IO () main = do args <- getArgs result <- case args of - [token] -> GitHub.listTeamsCurrent' (GitHub.OAuth $ fromString token) + [token] -> GH.github (GH.OAuth $ fromString token) GH.listTeamsCurrentR GH.FetchAll _ -> error "usage: ListTeamsCurrent " case result of Left err -> putStrLn $ "Error: " <> tshow err diff --git a/samples/Teams/Memberships/AddTeamMembershipFor.hs b/samples/Teams/Memberships/AddTeamMembershipFor.hs index b07bee73..58c120a2 100644 --- a/samples/Teams/Memberships/AddTeamMembershipFor.hs +++ b/samples/Teams/Memberships/AddTeamMembershipFor.hs @@ -5,20 +5,18 @@ 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, username] -> - GitHub.addTeamMembershipFor' - (GitHub.OAuth $ fromString token) - (GitHub.mkTeamId $ read team_id) - (GitHub.mkOwnerName $ fromString username) - GitHub.RoleMember - _ -> - error "usage: AddTeamMembershipFor " + [token, team_id, username] -> GitHub.github + (GitHub.OAuth $ fromString token) + GitHub.addTeamMembershipForR + (GitHub.mkTeamId $ read team_id) + (GitHub.mkOwnerName $ fromString username) + GitHub.RoleMember + _ -> fail "usage: AddTeamMembershipFor " case result of Left err -> putStrLn $ "Error: " <> tshow err Right team -> putStrLn $ tshow team diff --git a/samples/Teams/TeamInfoFor.hs b/samples/Teams/TeamInfoFor.hs index c128e8b8..7a8744f8 100644 --- a/samples/Teams/TeamInfoFor.hs +++ b/samples/Teams/TeamInfoFor.hs @@ -4,15 +4,14 @@ module Main (main) where import Common -import qualified GitHub -import qualified GitHub.Endpoints.Organizations.Teams as GitHub +import qualified GitHub as GH main :: IO () main = do args <- getArgs result <- case args of - [team_id, token] -> GitHub.teamInfoFor' (Just $ GitHub.OAuth $ fromString token) (GitHub.mkTeamId $ read team_id) - [team_id] -> GitHub.teamInfoFor (GitHub.mkTeamId $ read team_id) + [team_id, token] -> GH.github (GH.OAuth $ fromString token) GH.teamInfoForR (GH.mkTeamId $ read team_id) + [team_id] -> GH.github' GH.teamInfoForR (GH.mkTeamId $ read team_id) _ -> error "usage: TeamInfoFor [auth token]" case result of Left err -> putStrLn $ "Error: " <> tshow err diff --git a/samples/Users/ShowUser.hs b/samples/Users/ShowUser.hs index d5b8f09a..9ec6e423 100644 --- a/samples/Users/ShowUser.hs +++ b/samples/Users/ShowUser.hs @@ -6,38 +6,37 @@ import Prelude () import Data.Maybe (fromMaybe) -import qualified GitHub -import qualified GitHub.Endpoints.Users as GitHub +import qualified GitHub as GH main :: IO () main = do - auth <- getAuth - possibleUser <- GitHub.userInfoFor' auth "mike-burns" + mauth <- getAuth + possibleUser <- maybe GH.github' GH.github mauth GH.userInfoForR "mike-burns" putStrLn $ either (("Error: " <>) . tshow) formatUser possibleUser -formatUser :: GitHub.User -> Text +formatUser :: GH.User -> Text formatUser user = - (formatName userName login) <> "\t" <> (fromMaybe "" company) <> "\t" <> - (fromMaybe "" location) <> "\n" <> - (fromMaybe "" blog) <> "\t" <> "<" <> (fromMaybe "" email) <> ">" <> "\n" <> - GitHub.getUrl htmlUrl <> "\t" <> tshow createdAt <> "\n" <> + formatName userName login <> "\t" <> fromMaybe "" company <> "\t" <> + fromMaybe "" location <> "\n" <> + fromMaybe "" blog <> "\t" <> "<" <> fromMaybe "" email <> ">" <> "\n" <> + GH.getUrl htmlUrl <> "\t" <> tshow createdAt <> "\n" <> "hireable: " <> formatHireable (fromMaybe False isHireable) <> "\n\n" <> - (fromMaybe "" bio) + fromMaybe "" bio where - userName = GitHub.userName user - login = GitHub.userLogin user - company = GitHub.userCompany user - location = GitHub.userLocation user - blog = GitHub.userBlog user - email = GitHub.userEmail user - htmlUrl = GitHub.userHtmlUrl user - createdAt = GitHub.userCreatedAt user - isHireable = GitHub.userHireable user - bio = GitHub.userBio user + userName = GH.userName user + login = GH.userLogin user + company = GH.userCompany user + location = GH.userLocation user + blog = GH.userBlog user + email = GH.userEmail user + htmlUrl = GH.userHtmlUrl user + createdAt = GH.userCreatedAt user + isHireable = GH.userHireable user + bio = GH.userBio user -formatName :: Maybe Text -> GitHub.Name GitHub.User -> Text -formatName Nothing login = GitHub.untagName login -formatName (Just name) login = name <> "(" <> GitHub.untagName login <> ")" +formatName :: Maybe Text -> GH.Name GH.User -> Text +formatName Nothing login = GH.untagName login +formatName (Just name) login = name <> "(" <> GH.untagName login <> ")" formatHireable :: Bool -> Text formatHireable True = "yes" diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 0fa802e5..f0d4a4e7 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: github-samples -version: 0.0.0 +version: 0 category: Examples synopsis: Samples for github package license: BSD-3-Clause @@ -71,40 +71,40 @@ executable github-create-deploy-key main-is: CreateDeployKey.hs hs-source-dirs: Repos/DeployKeys -executable github-delete-deploy-key - import: deps - main-is: DeleteDeployKey.hs - hs-source-dirs: Repos/DeployKeys +-- executable github-delete-deploy-key +-- import: deps +-- main-is: DeleteDeployKey.hs +-- hs-source-dirs: Repos/DeployKeys -executable github-delete-team - import: deps - main-is: DeleteTeam.hs - hs-source-dirs: Teams +-- executable github-delete-team +-- import: deps +-- main-is: DeleteTeam.hs +-- hs-source-dirs: Teams -executable github-delete-team-membership-for - import: deps - main-is: DeleteTeamMembershipFor.hs - hs-source-dirs: Teams/Memberships +-- executable github-delete-team-membership-for +-- import: deps +-- main-is: DeleteTeamMembershipFor.hs +-- hs-source-dirs: Teams/Memberships executable github-edit-team import: deps main-is: EditTeam.hs hs-source-dirs: Teams -executable github-list-deploy-keys-for - import: deps - main-is: ListDeployKeys.hs - hs-source-dirs: Repos/DeployKeys +-- executable github-list-deploy-keys-for +-- import: deps +-- main-is: ListDeployKeys.hs +-- hs-source-dirs: Repos/DeployKeys executable github-list-followers import: deps main-is: ListFollowers.hs hs-source-dirs: Users/Followers -executable github-list-followers-example - import: deps - main-is: Example.hs - hs-source-dirs: Users/Followers +-- executable github-list-followers-example +-- import: deps +-- main-is: Example.hs +-- hs-source-dirs: Users/Followers executable github-list-following import: deps @@ -116,20 +116,20 @@ executable github-list-team-current main-is: ListTeamsCurrent.hs hs-source-dirs: Teams -executable github-list-team-repos - import: deps - main-is: ListRepos.hs - hs-source-dirs: Teams +-- executable github-list-team-repos +-- import: deps +-- main-is: ListRepos.hs +-- hs-source-dirs: Teams -executable github-repos-contents-example - import: deps - main-is: Contents.hs - hs-source-dirs: Repos +-- executable github-repos-contents-example +-- import: deps +-- main-is: Contents.hs +-- hs-source-dirs: Repos -executable github-show-deploy-key - import: deps - main-is: ShowDeployKey.hs - hs-source-dirs: Repos/DeployKeys +-- executable github-show-deploy-key +-- import: deps +-- main-is: ShowDeployKey.hs +-- hs-source-dirs: Repos/DeployKeys executable github-show-user import: deps @@ -141,37 +141,37 @@ executable github-show-user-2 main-is: ShowUser2.hs hs-source-dirs: Users -executable github-team-membership-info-for - import: deps - main-is: TeamMembershipInfoFor.hs - hs-source-dirs: Teams/Memberships +-- executable github-team-membership-info-for +-- import: deps +-- main-is: TeamMembershipInfoFor.hs +-- hs-source-dirs: Teams/Memberships executable github-teaminfo-for import: deps main-is: TeamInfoFor.hs hs-source-dirs: Teams -executable github-create-public-ssh-key - import: deps - main-is: CreatePublicSSHKey.hs - hs-source-dirs: Users/PublicSSHKeys - -executable github-delete-public-ssh-key - import: deps - main-is: DeletePublicSSHKey.hs - hs-source-dirs: Users/PublicSSHKeys - -executable github-list-public-ssh-keys - import: deps - main-is: ListPublicSSHKeys.hs - hs-source-dirs: Users/PublicSSHKeys - -executable github-get-public-ssh-key - import: deps - main-is: ShowPublicSSHKey.hs - hs-source-dirs: Users/PublicSSHKeys - -executable github-repos-commits-diff - import: deps - main-is: GitDiff.hs - hs-source-dirs: Repos/Commits +-- executable github-create-public-ssh-key +-- import: deps +-- main-is: CreatePublicSSHKey.hs +-- hs-source-dirs: Users/PublicSSHKeys + +-- executable github-delete-public-ssh-key +-- import: deps +-- main-is: DeletePublicSSHKey.hs +-- hs-source-dirs: Users/PublicSSHKeys + +-- executable github-list-public-ssh-keys +-- import: deps +-- main-is: ListPublicSSHKeys.hs +-- hs-source-dirs: Users/PublicSSHKeys + +-- executable github-get-public-ssh-key +-- import: deps +-- main-is: ShowPublicSSHKey.hs +-- hs-source-dirs: Users/PublicSSHKeys + +-- executable github-repos-commits-diff +-- import: deps +-- main-is: GitDiff.hs +-- hs-source-dirs: Repos/Commits diff --git a/spec/GitHub/ActivitySpec.hs b/spec/GitHub/ActivitySpec.hs index aaee99a7..1f3c82c3 100644 --- a/spec/GitHub/ActivitySpec.hs +++ b/spec/GitHub/ActivitySpec.hs @@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} module GitHub.ActivitySpec where import qualified GitHub diff --git a/spec/GitHub/CommitsSpec.hs b/spec/GitHub/CommitsSpec.hs index 3bf5fc53..5bf2d6a0 100644 --- a/spec/GitHub/CommitsSpec.hs +++ b/spec/GitHub/CommitsSpec.hs @@ -1,13 +1,9 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} module GitHub.CommitsSpec where -import qualified GitHub - import GitHub.Auth (Auth (..)) -import GitHub.Endpoints.Repos.Commits (commitSha, commitsFor', - commitsForR, diffR, mkCommitName) -import GitHub.Request (executeRequest) +import GitHub.Endpoints.Repos.Commits (commitSha, commitsForR, diffR, mkCommitName, FetchCount (..)) +import GitHub.Request (github) import Control.Monad (forM_) import Data.Either.Compat (isRight) @@ -34,13 +30,13 @@ spec :: Spec spec = do describe "commitsFor" $ do it "works" $ withAuth $ \auth -> do - cs <- commitsFor' (Just auth) "phadej" "github" + cs <- github auth commitsForR "phadej" "github" FetchAll cs `shouldSatisfy` isRight V.length (fromRightS cs) `shouldSatisfy` (> 300) -- Page size is 30, so we get 60 commits it "limits the response" $ withAuth $ \auth -> do - cs <- executeRequest auth $ commitsForR "phadej" "github" (GitHub.FetchAtLeast 40) + cs <- github auth commitsForR "phadej" "github" (FetchAtLeast 40) cs `shouldSatisfy` isRight let cs' = fromRightS cs V.length cs' `shouldSatisfy` (< 70) @@ -49,19 +45,19 @@ spec = do describe "diff" $ do it "works" $ withAuth $ \auth -> do - cs <- executeRequest auth $ commitsForR "phadej" "github" (GitHub.FetchAtLeast 30) + cs <- github auth commitsForR "phadej" "github" (FetchAtLeast 30) cs `shouldSatisfy` isRight let commits = take 10 . V.toList . fromRightS $ cs let pairs = zip commits $ drop 1 commits forM_ pairs $ \(a, b) -> do - d <- executeRequest auth $ diffR "phadej" "github" (commitSha a) (commitSha b) + d <- github auth diffR "phadej" "github" (commitSha a) (commitSha b) d `shouldSatisfy` isRight it "issue #155" $ withAuth $ \auth -> do - d <- executeRequest auth $ diffR "nomeata" "codespeed" (mkCommitName "ghc") (mkCommitName "tobami:master") + d <- github auth diffR "nomeata" "codespeed" (mkCommitName "ghc") (mkCommitName "tobami:master") d `shouldSatisfy` isRight -- diff that includes a commit where a submodule is removed it "issue #339" $ withAuth $ \auth -> do - d <- executeRequest auth $ diffR "scott-fleischman" "repo-remove-submodule" "d03c152482169d809be9b1eab71dcf64d7405f76" "42cfd732b20cd093534f246e630b309186eb485d" + d <- github auth diffR "scott-fleischman" "repo-remove-submodule" "d03c152482169d809be9b1eab71dcf64d7405f76" "42cfd732b20cd093534f246e630b309186eb485d" d `shouldSatisfy` isRight diff --git a/spec/GitHub/OrganizationsSpec.hs b/spec/GitHub/OrganizationsSpec.hs index 171a29ed..b6e7aea3 100644 --- a/spec/GitHub/OrganizationsSpec.hs +++ b/spec/GitHub/OrganizationsSpec.hs @@ -2,11 +2,12 @@ {-# LANGUAGE TemplateHaskell #-} module GitHub.OrganizationsSpec where +import GitHub (FetchCount (..), github) import GitHub.Auth (Auth (..)) import GitHub.Data (SimpleOrganization (..), SimpleOwner (..), SimpleTeam (..)) -import GitHub.Endpoints.Organizations (publicOrganizationsFor') -import GitHub.Endpoints.Organizations.Members (membersOf') +import GitHub.Endpoints.Organizations (publicOrganizationsForR) +import GitHub.Endpoints.Organizations.Members (membersOfR) import Data.Aeson (eitherDecodeStrict) import Data.Either.Compat (isRight) @@ -35,7 +36,7 @@ spec = do simpleOrganizationLogin (head $ fromRightS orgs) `shouldBe` "github" it "returns information about the user's organizations" $ withAuth $ \auth -> do - orgs <- publicOrganizationsFor' (Just auth) "mike-burns" + orgs <- github auth publicOrganizationsForR "mike-burns" FetchAll orgs `shouldSatisfy` isRight describe "teamsOf" $ do @@ -49,5 +50,5 @@ spec = do simpleOwnerLogin (head $ fromRightS ms) `shouldBe` "octocat" it "works" $ withAuth $ \auth -> do - ms <- membersOf' (Just auth) "haskell" + ms <- github auth membersOfR "haskell" FetchAll ms `shouldSatisfy` isRight diff --git a/spec/GitHub/PublicSSHKeysSpec.hs b/spec/GitHub/PublicSSHKeysSpec.hs index b797c959..25b17dae 100644 --- a/spec/GitHub/PublicSSHKeysSpec.hs +++ b/spec/GitHub/PublicSSHKeysSpec.hs @@ -1,11 +1,10 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} module GitHub.PublicSSHKeysSpec where import GitHub - (Auth (..), FetchCount (..), PublicSSHKey (..), executeRequest) + (Auth (..), FetchCount (..), PublicSSHKey (..),github) import GitHub.Endpoints.Users.PublicSSHKeys - (publicSSHKey', publicSSHKeys', publicSSHKeysForR) + (publicSSHKeyR, publicSSHKeysR, publicSSHKeysForR) import Data.Either.Compat (isRight) import Data.String (fromString) @@ -29,13 +28,13 @@ spec :: Spec spec = do describe "publicSSHKeysFor'" $ do it "works" $ withAuth $ \auth -> do - keys <- executeRequest auth $ publicSSHKeysForR "phadej" FetchAll + keys <- github auth publicSSHKeysForR "phadej" FetchAll V.length (fromRightS keys) `shouldSatisfy` (> 1) describe "publicSSHKeys' and publicSSHKey'" $ do it "works" $ withAuth $ \auth -> do - keys <- publicSSHKeys' auth + keys <- github auth publicSSHKeysR V.length (fromRightS keys) `shouldSatisfy` (> 1) - key <- publicSSHKey' auth (publicSSHKeyId $ V.head (fromRightS keys)) + key <- github auth publicSSHKeyR (publicSSHKeyId $ V.head (fromRightS keys)) key `shouldSatisfy` isRight diff --git a/spec/GitHub/ReleasesSpec.hs b/spec/GitHub/ReleasesSpec.hs index db01348f..a2988f91 100644 --- a/spec/GitHub/ReleasesSpec.hs +++ b/spec/GitHub/ReleasesSpec.hs @@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} module GitHub.ReleasesSpec where import qualified GitHub diff --git a/spec/GitHub/ReposSpec.hs b/spec/GitHub/ReposSpec.hs index 5b6ab190..a08ca00d 100644 --- a/spec/GitHub/ReposSpec.hs +++ b/spec/GitHub/ReposSpec.hs @@ -1,16 +1,16 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TemplateHaskell #-} module GitHub.ReposSpec where -import GitHub (Auth (..), Repo (..), RepoPublicity (..), - executeRequest, repositoryR) -import GitHub.Endpoints.Repos (currentUserRepos, languagesFor', userRepos') +import GitHub + (Auth (..), FetchCount (..), Repo (..), RepoPublicity (..), github, + repositoryR) +import GitHub.Endpoints.Repos (currentUserReposR, languagesForR, userReposR) import Data.Either.Compat (isRight) import Data.String (fromString) import System.Environment (lookupEnv) -import Test.Hspec (Spec, describe, it, pendingWith, shouldBe, - shouldSatisfy) +import Test.Hspec + (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy) import qualified Data.HashMap.Strict as HM @@ -29,7 +29,7 @@ spec :: Spec spec = do describe "repositoryR" $ do it "works" $ withAuth $ \auth -> do - er <- executeRequest auth $ repositoryR "phadej" "github" + er <- github auth repositoryR "phadej" "github" er `shouldSatisfy` isRight let Right r = er -- https://github.com/phadej/github/pull/219 @@ -37,16 +37,16 @@ spec = do describe "currentUserRepos" $ do it "works" $ withAuth $ \auth -> do - cs <- currentUserRepos auth RepoPublicityAll + cs <- github auth currentUserReposR RepoPublicityAll FetchAll cs `shouldSatisfy` isRight describe "userRepos" $ do it "works" $ withAuth $ \auth -> do - cs <- userRepos' (Just auth) "phadej" RepoPublicityAll + cs <- github auth userReposR "phadej" RepoPublicityAll FetchAll cs `shouldSatisfy` isRight describe "languagesFor'" $ do it "works" $ withAuth $ \auth -> do - ls <- languagesFor' (Just auth) "phadej" "github" + ls <- github auth languagesForR "phadej" "github" ls `shouldSatisfy` isRight fromRightS ls `shouldSatisfy` HM.member "Haskell" diff --git a/spec/GitHub/SearchSpec.hs b/spec/GitHub/SearchSpec.hs index 64f1680a..ce82900d 100644 --- a/spec/GitHub/SearchSpec.hs +++ b/spec/GitHub/SearchSpec.hs @@ -14,9 +14,10 @@ import Test.Hspec (Spec, describe, it, pendingWith, shouldBe) import qualified Data.Vector as V +import GitHub (github) import GitHub.Data (Auth (..), Issue (..), IssueNumber (..), IssueState (..), mkId) -import GitHub.Endpoints.Search (SearchResult (..), searchIssues') +import GitHub.Endpoints.Search (SearchResult (..), searchIssuesR) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -53,6 +54,6 @@ spec = do it "performs an issue search via the API" $ withAuth $ \auth -> do let query = "Decouple in:title repo:phadej/github created:<=2015-12-01" - issues <- searchResultResults . fromRightS <$> searchIssues' (Just auth) query + issues <- searchResultResults . fromRightS <$> github auth searchIssuesR query length issues `shouldBe` 1 issueId (V.head issues) `shouldBe` mkId (Proxy :: Proxy Issue) 119694665 diff --git a/spec/GitHub/UsersSpec.hs b/spec/GitHub/UsersSpec.hs index 6e55b649..abb2a882 100644 --- a/spec/GitHub/UsersSpec.hs +++ b/spec/GitHub/UsersSpec.hs @@ -15,9 +15,9 @@ import qualified GitHub import GitHub.Data (Auth (..), Organization (..), User (..), fromOwner) import GitHub.Endpoints.Users - (ownerInfoForR, userInfoCurrent', userInfoFor') + (ownerInfoForR, userInfoCurrentR, userInfoForR) import GitHub.Endpoints.Users.Followers (usersFollowedByR, usersFollowingR) -import GitHub.Request (executeRequest) +import GitHub.Request (github) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -46,37 +46,37 @@ spec = do userLogin (fromRightS userInfo) `shouldBe` "mike-burns" it "returns information about the user" $ withAuth $ \auth -> do - userInfo <- userInfoFor' (Just auth) "mike-burns" + userInfo <- github auth userInfoForR "mike-burns" userLogin (fromRightS userInfo) `shouldBe` "mike-burns" it "catches http exceptions" $ withAuth $ \auth -> do - userInfo <- userInfoFor' (Just auth) "i-hope-this-user-will-never-exist" + userInfo <- github auth userInfoForR "i-hope-this-user-will-never-exist" userInfo `shouldSatisfy` isLeft it "should fail for organization" $ withAuth $ \auth -> do - userInfo <- userInfoFor' (Just auth) "haskell" + userInfo <- github auth userInfoForR "haskell" userInfo `shouldSatisfy` isLeft describe "ownerInfoFor" $ do it "works for users and organizations" $ withAuth $ \auth -> do - a <- executeRequest auth $ ownerInfoForR "haskell" - b <- executeRequest auth $ ownerInfoForR "phadej" + a <- github auth ownerInfoForR "haskell" + b <- github auth ownerInfoForR "phadej" a `shouldSatisfy` isRight b `shouldSatisfy` isRight (organizationLogin . fromRightS . fromOwner . fromRightS $ a) `shouldBe` "haskell" (userLogin . fromLeftS . fromOwner . fromRightS $ b) `shouldBe` "phadej" - describe "userInfoCurrent'" $ do + describe "userInfoCurrentR" $ do it "returns information about the autenticated user" $ withAuth $ \auth -> do - userInfo <- userInfoCurrent' auth + userInfo <- github auth userInfoCurrentR userInfo `shouldSatisfy` isRight describe "usersFollowing" $ do it "works" $ withAuth $ \auth -> do - us <- executeRequest auth $ usersFollowingR "phadej" (GitHub.FetchAtLeast 10) + us <- github auth usersFollowingR "phadej" (GitHub.FetchAtLeast 10) us `shouldSatisfy` isRight describe "usersFollowedBy" $ do it "works" $ withAuth $ \auth -> do - us <- executeRequest auth $ usersFollowedByR "phadej" (GitHub.FetchAtLeast 10) + us <- github auth usersFollowedByR "phadej" (GitHub.FetchAtLeast 10) us `shouldSatisfy` isRight diff --git a/src/GitHub.hs b/src/GitHub.hs index ab660395..2faf1618 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -152,11 +152,8 @@ module GitHub ( -- milestonesR, milestoneR, - createMilestone, createMilestoneR, - updateMilestone, updateMilestoneR, - deleteMilestone, deleteMilestoneR, -- * Organizations @@ -237,14 +234,8 @@ module GitHub ( -- * Submit a pull request review -- * Dismiss a pull request review pullRequestReviewsR, - pullRequestReviews, - pullRequestReviews', pullRequestReviewR, - pullRequestReview, - pullRequestReview', pullRequestReviewCommentsR, - pullRequestReviewCommentsIO, - pullRequestReviewCommentsIO', -- * Repositories -- | See diff --git a/src/GitHub/Endpoints/Activity/Notifications.hs b/src/GitHub/Endpoints/Activity/Notifications.hs index 1561390c..7c246c54 100644 --- a/src/GitHub/Endpoints/Activity/Notifications.hs +++ b/src/GitHub/Endpoints/Activity/Notifications.hs @@ -6,26 +6,21 @@ -- The repo watching API as described on -- . -module GitHub.Endpoints.Activity.Notifications where +module GitHub.Endpoints.Activity.Notifications ( + getNotificationsR, + markNotificationAsReadR, + markAllNotificationsAsReadR, + ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () -getNotifications :: Auth -> IO (Either Error (Vector Notification)) -getNotifications auth = - executeRequest auth $ getNotificationsR FetchAll - -- | List your notifications. -- See getNotificationsR :: FetchCount -> Request 'RA (Vector Notification) getNotificationsR = pagedQuery ["notifications"] [] -markNotificationAsRead :: Auth -> Id Notification -> IO (Either Error ()) -markNotificationAsRead auth nid = - executeRequest auth $ markNotificationAsReadR nid - -- | Mark a thread as read. -- See markNotificationAsReadR :: Id Notification -> GenRequest 'MtUnit 'RW () @@ -34,10 +29,6 @@ markNotificationAsReadR nid = Command ["notifications", "threads", toPathPart nid] (encode ()) -markNotificationsAsRead :: Auth -> IO (Either Error ()) -markNotificationsAsRead auth = - executeRequest auth markAllNotificationsAsReadR - -- | Mark as read. -- See markAllNotificationsAsReadR :: GenRequest 'MtUnit 'RW () diff --git a/src/GitHub/Endpoints/Activity/Starring.hs b/src/GitHub/Endpoints/Activity/Starring.hs index 4eccfc5b..be589db0 100644 --- a/src/GitHub/Endpoints/Activity/Starring.hs +++ b/src/GitHub/Endpoints/Activity/Starring.hs @@ -6,17 +6,11 @@ -- The repo starring API as described on -- . module GitHub.Endpoints.Activity.Starring ( - stargazersFor, stargazersForR, - reposStarredBy, reposStarredByR, - myStarred, myStarredR, - myStarredAcceptStar, myStarredAcceptStarR, - starRepo, starRepoR, - unstarRepo, unstarRepoR, module GitHub.Data, ) where @@ -24,60 +18,30 @@ module GitHub.Endpoints.Activity.Starring ( import GitHub.Auth import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | The list of users that have starred the specified Github repo. --- --- > userInfoFor' Nothing "mike-burns" -stargazersFor :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser)) -stargazersFor auth user repo = - executeRequestMaybe auth $ stargazersForR user repo FetchAll - -- | List Stargazers. -- See stargazersForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector SimpleUser) stargazersForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "stargazers"] [] --- | All the public repos starred by the specified user. --- --- > reposStarredBy Nothing "croaky" -reposStarredBy :: Maybe Auth -> Name Owner -> IO (Either Error (Vector Repo)) -reposStarredBy auth user = - executeRequestMaybe auth $ reposStarredByR user FetchAll - -- | List repositories being starred. -- See reposStarredByR :: Name Owner -> FetchCount -> Request k (Vector Repo) reposStarredByR user = pagedQuery ["users", toPathPart user, "starred"] [] --- | All the repos starred by the authenticated user. -myStarred :: Auth -> IO (Either Error (Vector Repo)) -myStarred auth = - executeRequest auth $ myStarredR FetchAll - -- | All the repos starred by the authenticated user. -- See myStarredR :: FetchCount -> Request 'RA (Vector Repo) myStarredR = pagedQuery ["user", "starred"] [] - --- | All the repos starred by the authenticated user. -myStarredAcceptStar :: Auth -> IO (Either Error (Vector RepoStarred)) -myStarredAcceptStar auth = - executeRequest auth $ myStarredAcceptStarR FetchAll - -- | All the repos starred by the authenticated user. -- See myStarredAcceptStarR :: FetchCount -> GenRequest 'MtStar 'RA (Vector RepoStarred) myStarredAcceptStarR = PagedQuery ["user", "starred"] [] --- | Star a repo by the authenticated user. -starRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ()) -starRepo auth user repo = executeRequest auth $ starRepoR user repo - -- | Star a repo by the authenticated user. -- See starRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW () @@ -85,10 +49,6 @@ starRepoR user repo = Command Put paths mempty where paths = ["user", "starred", toPathPart user, toPathPart repo] --- | Unstar a repo by the authenticated user. -unstarRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ()) -unstarRepo auth user repo = executeRequest auth $ unstarRepoR user repo - -- | Unstar a repo by the authenticated user. -- See unstarRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW () diff --git a/src/GitHub/Endpoints/Activity/Watching.hs b/src/GitHub/Endpoints/Activity/Watching.hs index d250878e..cd58b44f 100644 --- a/src/GitHub/Endpoints/Activity/Watching.hs +++ b/src/GitHub/Endpoints/Activity/Watching.hs @@ -6,11 +6,7 @@ -- The repo watching API as described on -- . module GitHub.Endpoints.Activity.Watching ( - watchersFor, - watchersFor', watchersForR, - reposWatchedBy, - reposWatchedBy', reposWatchedByR, module GitHub.Data, ) where @@ -18,43 +14,14 @@ module GitHub.Endpoints.Activity.Watching ( import GitHub.Auth import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | The list of users that are watching the specified Github repo. --- --- > watchersFor "thoughtbot" "paperclip" -watchersFor :: Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser)) -watchersFor = watchersFor' Nothing - --- | The list of users that are watching the specified Github repo. --- With authentication --- --- > watchersFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -watchersFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser)) -watchersFor' auth user repo = - executeRequestMaybe auth $ watchersForR user repo FetchAll - -- | List watchers. -- See watchersForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector SimpleUser) watchersForR user repo limit = pagedQuery ["repos", toPathPart user, toPathPart repo, "watchers"] [] limit --- | All the public repos watched by the specified user. --- --- > reposWatchedBy "croaky" -reposWatchedBy :: Name Owner -> IO (Either Error (Vector Repo)) -reposWatchedBy = reposWatchedBy' Nothing - --- | All the public repos watched by the specified user. --- With authentication --- --- > reposWatchedBy' (Just $ BasicAuth "github-username" "github-password") "croaky" -reposWatchedBy' :: Maybe Auth -> Name Owner -> IO (Either Error (Vector Repo)) -reposWatchedBy' auth user = - executeRequestMaybe auth $ reposWatchedByR user FetchAll - -- | List repositories being watched. -- See reposWatchedByR :: Name Owner -> FetchCount -> Request k (Vector Repo) diff --git a/src/GitHub/Endpoints/Gists.hs b/src/GitHub/Endpoints/Gists.hs index 773e7f17..783e0588 100644 --- a/src/GitHub/Endpoints/Gists.hs +++ b/src/GitHub/Endpoints/Gists.hs @@ -5,91 +5,39 @@ -- -- The gists API as described at . module GitHub.Endpoints.Gists ( - gists, - gists', gistsR, - gist, - gist', gistR, - starGist, starGistR, - unstarGist, unstarGistR, - deleteGist, deleteGistR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | The list of all gists created by the user --- --- > gists' (Just $ BasicAuth "github-username" "github-password") "mike-burns" -gists' :: Maybe Auth -> Name Owner -> IO (Either Error (Vector Gist)) -gists' auth user = - executeRequestMaybe auth $ gistsR user FetchAll - --- | The list of all public gists created by the user. --- --- > gists "mike-burns" -gists :: Name Owner -> IO (Either Error (Vector Gist)) -gists = gists' Nothing - -- | List gists. -- See gistsR :: Name Owner -> FetchCount -> Request k (Vector Gist) gistsR user = pagedQuery ["users", toPathPart user, "gists"] [] --- | A specific gist, given its id, with authentication credentials --- --- > gist' (Just $ BasicAuth "github-username" "github-password") "225074" -gist' :: Maybe Auth -> Name Gist -> IO (Either Error Gist) -gist' auth gid = - executeRequestMaybe auth $ gistR gid - --- | A specific gist, given its id. --- --- > gist "225074" -gist :: Name Gist -> IO (Either Error Gist) -gist = gist' Nothing - -- | Query a single gist. -- See gistR :: Name Gist -> Request k Gist gistR gid = query ["gists", toPathPart gid] [] --- | Star a gist by the authenticated user. --- --- > starGist (BasicAuth "github-username" "github-password") "225074" -starGist :: Auth -> Name Gist -> IO (Either Error ()) -starGist auth gid = executeRequest auth $ starGistR gid - -- | Star a gist by the authenticated user. -- See starGistR :: Name Gist -> GenRequest 'MtUnit 'RW () starGistR gid = Command Put ["gists", toPathPart gid, "star"] mempty --- | Unstar a gist by the authenticated user. --- --- > unstarGist (BasicAuth "github-username" "github-password") "225074" -unstarGist :: Auth -> Name Gist -> IO (Either Error ()) -unstarGist auth gid = executeRequest auth $ unstarGistR gid - -- | Unstar a gist by the authenticated user. -- See unstarGistR :: Name Gist -> GenRequest 'MtUnit 'RW () unstarGistR gid = Command Delete ["gists", toPathPart gid, "star"] mempty --- | Delete a gist by the authenticated user. --- --- > deleteGist (BasicAuth "github-username" "github-password") "225074" -deleteGist :: Auth -> Name Gist -> IO (Either Error ()) -deleteGist auth gid = executeRequest auth $ deleteGistR gid - -- | Delete a gist by the authenticated user. -- See deleteGistR :: Name Gist -> GenRequest 'MtUnit 'RW () diff --git a/src/GitHub/Endpoints/Gists/Comments.hs b/src/GitHub/Endpoints/Gists/Comments.hs index 98da18c2..d6a127dd 100644 --- a/src/GitHub/Endpoints/Gists/Comments.hs +++ b/src/GitHub/Endpoints/Gists/Comments.hs @@ -6,38 +6,21 @@ -- The loving comments people have left on Gists, described on -- . module GitHub.Endpoints.Gists.Comments ( - commentsOn, commentsOnR, - comment, gistCommentR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All the comments on a Gist, given the Gist ID. --- --- > commentsOn "1174060" -commentsOn :: Name Gist -> IO (Either Error (Vector GistComment)) -commentsOn gid = - executeRequest' $ commentsOnR gid FetchAll - -- | List comments on a gist. -- See commentsOnR :: Name Gist -> FetchCount -> Request k (Vector GistComment) commentsOnR gid = pagedQuery ["gists", toPathPart gid, "comments"] [] --- | A specific comment, by the comment ID. --- --- > comment (Id 62449) -comment :: Id GistComment -> IO (Either Error GistComment) -comment cid = - executeRequest' $ gistCommentR cid - -- | Query a single comment. -- See gistCommentR :: Id GistComment -> Request k GistComment diff --git a/src/GitHub/Endpoints/GitData/Blobs.hs b/src/GitHub/Endpoints/GitData/Blobs.hs index 1de49084..4c3c5f88 100644 --- a/src/GitHub/Endpoints/GitData/Blobs.hs +++ b/src/GitHub/Endpoints/GitData/Blobs.hs @@ -6,30 +6,13 @@ -- The API for dealing with git blobs from Github repos, as described in -- . module GitHub.Endpoints.GitData.Blobs ( - blob, - blob', blobR, module GitHub.Data, ) where import GitHub.Data -import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | Query a blob by SHA1. --- --- > blob' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9" -blob' :: Maybe Auth -> Name Owner -> Name Repo -> Name Blob -> IO (Either Error Blob) -blob' auth user repo sha = - executeRequestMaybe auth $ blobR user repo sha - --- | Query a blob by SHA1. --- --- > blob "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9" -blob :: Name Owner -> Name Repo -> Name Blob -> IO (Either Error Blob) -blob = blob' Nothing - -- | Query a blob. -- See blobR :: Name Owner -> Name Repo -> Name Blob -> Request k Blob diff --git a/src/GitHub/Endpoints/GitData/Commits.hs b/src/GitHub/Endpoints/GitData/Commits.hs index 1d8ced18..109ca87d 100644 --- a/src/GitHub/Endpoints/GitData/Commits.hs +++ b/src/GitHub/Endpoints/GitData/Commits.hs @@ -6,23 +6,13 @@ -- The API for underlying git commits of a Github repo, as described on -- . module GitHub.Endpoints.GitData.Commits ( - commit, gitCommitR, module GitHub.Data, ) where import GitHub.Data -import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | A single commit, by SHA1. --- --- > commit "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9" -commit :: Name Owner -> Name Repo -> Name GitCommit -> IO (Either Error GitCommit) -commit user repo sha = - executeRequest' $ gitCommitR user repo sha - -- | Query a commit. -- See gitCommitR :: Name Owner -> Name Repo -> Name GitCommit -> Request k GitCommit diff --git a/src/GitHub/Endpoints/GitData/References.hs b/src/GitHub/Endpoints/GitData/References.hs index ba5e7bc8..270d8805 100644 --- a/src/GitHub/Endpoints/GitData/References.hs +++ b/src/GitHub/Endpoints/GitData/References.hs @@ -7,79 +7,35 @@ -- see. The git internals documentation will also prove handy for understanding -- these. API documentation at . module GitHub.Endpoints.GitData.References ( - reference, - reference', referenceR, - references, - references', referencesR, - createReference, createReferenceR, - namespacedReferences, + namespacedReferencesR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | A single reference by the ref name. --- --- > reference' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github" "heads/master" -reference' :: Maybe Auth -> Name Owner -> Name Repo -> Name GitReference -> IO (Either Error GitReference) -reference' auth user repo ref = - executeRequestMaybe auth $ referenceR user repo ref - --- | A single reference by the ref name. --- --- > reference "mike-burns" "github" "heads/master" -reference :: Name Owner -> Name Repo -> Name GitReference -> IO (Either Error GitReference) -reference = reference' Nothing - --- | Query a reference. +-- | A single reference -- | Query a reference. -- See referenceR :: Name Owner -> Name Repo -> Name GitReference -> Request k GitReference referenceR user repo ref = query ["repos", toPathPart user, toPathPart repo, "git", "refs", toPathPart ref] [] --- | The history of references for a repo. --- --- > references "mike-burns" "github" -references' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector GitReference)) -references' auth user repo = - executeRequestMaybe auth $ referencesR user repo FetchAll - --- | The history of references for a repo. --- --- > references "mike-burns" "github" -references :: Name Owner -> Name Repo -> IO (Either Error (Vector GitReference)) -references = references' Nothing - -- | Query all References. -- See referencesR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector GitReference) referencesR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "git", "refs"] [] --- | Create a reference. -createReference :: Auth -> Name Owner -> Name Repo -> NewGitReference -> IO (Either Error GitReference) -createReference auth user repo newRef = - executeRequest auth $ createReferenceR user repo newRef - -- | Create a reference. -- See createReferenceR :: Name Owner -> Name Repo -> NewGitReference -> Request 'RW GitReference createReferenceR user repo newRef = command Post ["repos", toPathPart user, toPathPart repo , "git", "refs"] (encode newRef) --- | Limited references by a namespace. --- --- > namespacedReferences "thoughtbot" "paperclip" "tags" -namespacedReferences :: Name Owner -> Name Repo -> Text -> IO (Either Error [GitReference]) -namespacedReferences user repo namespace = - executeRequest' $ namespacedReferencesR user repo namespace - -- | Query namespaced references. -- See namespacedReferencesR :: Name Owner -> Name Repo -> Text -> Request k [GitReference] diff --git a/src/GitHub/Endpoints/GitData/Trees.hs b/src/GitHub/Endpoints/GitData/Trees.hs index b6bc550a..434d8e95 100644 --- a/src/GitHub/Endpoints/GitData/Trees.hs +++ b/src/GitHub/Endpoints/GitData/Trees.hs @@ -6,52 +6,21 @@ -- The underlying tree of SHA1s and files that make up a git repo. The API is -- described on . module GitHub.Endpoints.GitData.Trees ( - tree, - tree', treeR, - nestedTree, - nestedTree', nestedTreeR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | A tree for a SHA1. --- --- > tree (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844" -tree' :: Maybe Auth -> Name Owner -> Name Repo -> Name Tree -> IO (Either Error Tree) -tree' auth user repo sha = - executeRequestMaybe auth $ treeR user repo sha - --- | A tree for a SHA1. --- --- > tree "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844" -tree :: Name Owner -> Name Repo -> Name Tree -> IO (Either Error Tree) -tree = tree' Nothing - -- | Query a Tree. -- See treeR :: Name Owner -> Name Repo -> Name Tree -> Request k Tree treeR user repo sha = query ["repos", toPathPart user, toPathPart repo, "git", "trees", toPathPart sha] [] --- | A recursively-nested tree for a SHA1. --- --- > nestedTree' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844" -nestedTree' :: Maybe Auth -> Name Owner -> Name Repo -> Name Tree -> IO (Either Error Tree) -nestedTree' auth user repo sha = - executeRequestMaybe auth $ nestedTreeR user repo sha - --- | A recursively-nested tree for a SHA1. --- --- > nestedTree "thoughtbot" "paperclip" "fe114451f7d066d367a1646ca7ac10e689b46844" -nestedTree :: Name Owner -> Name Repo -> Name Tree -> IO (Either Error Tree) -nestedTree = nestedTree' Nothing - -- | Query a Tree Recursively. -- See nestedTreeR :: Name Owner -> Name Repo -> Name Tree -> Request k Tree diff --git a/src/GitHub/Endpoints/Issues.hs b/src/GitHub/Endpoints/Issues.hs index 92e73bbc..d2b24e69 100644 --- a/src/GitHub/Endpoints/Issues.hs +++ b/src/GitHub/Endpoints/Issues.hs @@ -8,16 +8,10 @@ module GitHub.Endpoints.Issues ( currentUserIssuesR, organizationIssuesR, - issue, - issue', issueR, - issuesForRepo, - issuesForRepo', issuesForRepoR, - createIssue, createIssueR, newIssue, - editIssue, editIssueR, editOfIssue, module GitHub.Data, @@ -25,7 +19,6 @@ module GitHub.Endpoints.Issues ( import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () -- | See . @@ -38,42 +31,12 @@ organizationIssuesR :: Name Organization -> IssueMod -> FetchCount -> Request k organizationIssuesR org opts = pagedQuery ["orgs", toPathPart org, "issues"] (issueModToQueryString opts) --- | Details on a specific issue, given the repo owner and name, and the issue --- number.' --- --- > issue' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "462" -issue' :: Maybe Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error Issue) -issue' auth user reqRepoName reqIssueNumber = - executeRequestMaybe auth $ issueR user reqRepoName reqIssueNumber - --- | Details on a specific issue, given the repo owner and name, and the issue --- number. --- --- > issue "thoughtbot" "paperclip" (Id "462") -issue :: Name Owner -> Name Repo -> Id Issue -> IO (Either Error Issue) -issue = issue' Nothing - -- | Query a single issue. -- See issueR :: Name Owner -> Name Repo -> Id Issue -> Request k Issue issueR user reqRepoName reqIssueNumber = query ["repos", toPathPart user, toPathPart reqRepoName, "issues", toPathPart reqIssueNumber] [] --- | All issues for a repo (given the repo owner and name), with optional --- restrictions as described in the 'IssueRepoMod' data type. --- --- > issuesForRepo' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" [NoMilestone, OnlyClosed, Mentions "jyurek", Ascending] -issuesForRepo' :: Maybe Auth -> Name Owner -> Name Repo -> IssueRepoMod -> IO (Either Error (Vector Issue)) -issuesForRepo' auth user reqRepoName opts = - executeRequestMaybe auth $ issuesForRepoR user reqRepoName opts FetchAll - --- | All issues for a repo (given the repo owner and name), with optional --- restrictions as described in the 'IssueRepoMod' data type. --- --- > issuesForRepo "thoughtbot" "paperclip" [NoMilestone, OnlyClosed, Mentions "jyurek", Ascending] -issuesForRepo :: Name Owner -> Name Repo -> IssueRepoMod -> IO (Either Error (Vector Issue)) -issuesForRepo = issuesForRepo' Nothing - -- | List issues for a repository. -- See issuesForRepoR :: Name Owner -> Name Repo -> IssueRepoMod -> FetchCount -> Request k (Vector Issue) @@ -87,16 +50,6 @@ issuesForRepoR user reqRepoName opts = newIssue :: Text -> NewIssue newIssue title = NewIssue title Nothing mempty Nothing Nothing - --- | Create a new issue. --- --- > createIssue (BasicAuth "github-username" "github-password") user repo --- > (newIssue "some_repo") {...} -createIssue :: Auth -> Name Owner -> Name Repo -> NewIssue - -> IO (Either Error Issue) -createIssue auth user repo ni = - executeRequest auth $ createIssueR user repo ni - -- | Create an issue. -- See createIssueR :: Name Owner -> Name Repo -> NewIssue -> Request 'RW Issue @@ -108,15 +61,6 @@ createIssueR user repo = editOfIssue :: EditIssue editOfIssue = EditIssue Nothing Nothing Nothing Nothing Nothing Nothing --- | Edit an issue. --- --- > editIssue (BasicAuth "github-username" "github-password") user repo issue --- > editOfIssue {...} -editIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> EditIssue - -> IO (Either Error Issue) -editIssue auth user repo iss edit = - executeRequest auth $ editIssueR user repo iss edit - -- | Edit an issue. -- See editIssueR :: Name Owner -> Name Repo -> Id Issue -> EditIssue -> Request 'RW Issue diff --git a/src/GitHub/Endpoints/Issues/Comments.hs b/src/GitHub/Endpoints/Issues/Comments.hs index 0968022b..18550abc 100644 --- a/src/GitHub/Endpoints/Issues/Comments.hs +++ b/src/GitHub/Endpoints/Issues/Comments.hs @@ -6,66 +6,30 @@ -- The Github issue comments API from -- . module GitHub.Endpoints.Issues.Comments ( - comment, commentR, - comments, commentsR, - comments', - createComment, createCommentR, - deleteComment, deleteCommentR, - editComment, editCommentR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | A specific comment, by ID. --- --- > comment "thoughtbot" "paperclip" 1468184 -comment :: Name Owner -> Name Repo -> Id Comment -> IO (Either Error IssueComment) -comment user repo cid = - executeRequest' $ commentR user repo cid - -- | Query a single comment. -- See commentR :: Name Owner -> Name Repo -> Id Comment -> Request k IssueComment commentR user repo cid = query ["repos", toPathPart user, toPathPart repo, "issues", "comments", toPathPart cid] [] --- | All comments on an issue, by the issue's number. --- --- > comments "thoughtbot" "paperclip" 635 -comments :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector IssueComment)) -comments = comments' Nothing - --- | All comments on an issue, by the issue's number, using authentication. --- --- > comments' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 635 -comments' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector IssueComment)) -comments' auth user repo iid = - executeRequestMaybe auth $ commentsR user repo iid FetchAll - -- | List comments on an issue. -- See commentsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector IssueComment) commentsR user repo iid = pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "comments"] [] --- | Create a new comment. --- --- > createComment (BasicAuth "github-username" "github-password") user repo issue --- > "some words" -createComment :: Auth -> Name Owner -> Name Repo -> IssueNumber -> Text - -> IO (Either Error Comment) -createComment auth user repo iss body = - executeRequest auth $ createCommentR user repo iss body - -- | Create a comment. -- See createCommentR :: Name Owner -> Name Repo -> IssueNumber -> Text -> Request 'RW Comment @@ -74,15 +38,6 @@ createCommentR user repo iss body = where parts = ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iss, "comments"] --- | Edit a comment. --- --- > editComment (BasicAuth "github-username" "github-password") user repo commentid --- > "new words" -editComment :: Auth -> Name Owner -> Name Repo -> Id Comment -> Text - -> IO (Either Error Comment) -editComment auth user repo commid body = - executeRequest auth $ editCommentR user repo commid body - -- | Edit a comment. -- See editCommentR :: Name Owner -> Name Repo -> Id Comment -> Text -> Request 'RW Comment @@ -91,14 +46,6 @@ editCommentR user repo commid body = where parts = ["repos", toPathPart user, toPathPart repo, "issues", "comments", toPathPart commid] --- | Delete a comment. --- --- > deleteComment (BasicAuth "github-username" "github-password") user repo commentid -deleteComment :: Auth -> Name Owner -> Name Repo -> Id Comment - -> IO (Either Error ()) -deleteComment auth user repo commid = - executeRequest auth $ deleteCommentR user repo commid - -- | Delete a comment. -- See deleteCommentR :: Name Owner -> Name Repo -> Id Comment -> GenRequest 'MtUnit 'RW () diff --git a/src/GitHub/Endpoints/Issues/Events.hs b/src/GitHub/Endpoints/Issues/Events.hs index c139f819..e69ed9fa 100644 --- a/src/GitHub/Endpoints/Issues/Events.hs +++ b/src/GitHub/Endpoints/Issues/Events.hs @@ -6,74 +6,28 @@ -- The Github issue events API, which is described on -- module GitHub.Endpoints.Issues.Events ( - eventsForIssue, - eventsForIssue', eventsForIssueR, - eventsForRepo, - eventsForRepo', eventsForRepoR, - event, - event', eventR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All events that have happened on an issue. --- --- > eventsForIssue "thoughtbot" "paperclip" 49 -eventsForIssue :: Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueEvent)) -eventsForIssue = eventsForIssue' Nothing - --- | All events that have happened on an issue, using authentication. --- --- > eventsForIssue' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 49 -eventsForIssue' :: Maybe Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueEvent)) -eventsForIssue' auth user repo iid = - executeRequestMaybe auth $ eventsForIssueR user repo iid FetchAll - -- | List events for an issue. -- See eventsForIssueR :: Name Owner -> Name Repo -> Id Issue -> FetchCount -> Request k (Vector IssueEvent) eventsForIssueR user repo iid = pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "events"] [] --- | All the events for all issues in a repo. --- --- > eventsForRepo "thoughtbot" "paperclip" -eventsForRepo :: Name Owner -> Name Repo -> IO (Either Error (Vector IssueEvent)) -eventsForRepo = eventsForRepo' Nothing - --- | All the events for all issues in a repo, using authentication. --- --- > eventsForRepo' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -eventsForRepo' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector IssueEvent)) -eventsForRepo' auth user repo = - executeRequestMaybe auth $ eventsForRepoR user repo FetchAll - -- | List events for a repository. -- See eventsForRepoR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector IssueEvent) eventsForRepoR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", "events"] [] --- | Details on a specific event, by the event's ID. --- --- > event "thoughtbot" "paperclip" 5335772 -event :: Name Owner -> Name Repo -> Id IssueEvent -> IO (Either Error IssueEvent) -event = event' Nothing - --- | Details on a specific event, by the event's ID, using authentication. --- --- > event' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 5335772 -event' :: Maybe Auth -> Name Owner -> Name Repo -> Id IssueEvent -> IO (Either Error IssueEvent) -event' auth user repo eid = - executeRequestMaybe auth $ eventR user repo eid - -- | Query a single event. -- See eventR :: Name Owner -> Name Repo -> Id IssueEvent -> Request k IssueEvent diff --git a/src/GitHub/Endpoints/Issues/Labels.hs b/src/GitHub/Endpoints/Issues/Labels.hs index 81affd8a..cb80992e 100644 --- a/src/GitHub/Endpoints/Issues/Labels.hs +++ b/src/GitHub/Endpoints/Issues/Labels.hs @@ -6,85 +6,36 @@ -- The API for dealing with labels on Github issues as described on -- . module GitHub.Endpoints.Issues.Labels ( - labelsOnRepo, - labelsOnRepo', labelsOnRepoR, - label, - label', labelR, - createLabel, createLabelR, - updateLabel, updateLabelR, - deleteLabel, deleteLabelR, - labelsOnIssue, - labelsOnIssue', labelsOnIssueR, - addLabelsToIssue, addLabelsToIssueR, - removeLabelFromIssue, removeLabelFromIssueR, - replaceAllLabelsForIssue, replaceAllLabelsForIssueR, - removeAllLabelsFromIssue, removeAllLabelsFromIssueR, - labelsOnMilestone, - labelsOnMilestone', labelsOnMilestoneR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All the labels available to use on any issue in the repo. --- --- > labelsOnRepo "thoughtbot" "paperclip" -labelsOnRepo :: Name Owner -> Name Repo -> IO (Either Error (Vector IssueLabel)) -labelsOnRepo = labelsOnRepo' Nothing - --- | All the labels available to use on any issue in the repo using authentication. --- --- > labelsOnRepo' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -labelsOnRepo' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector IssueLabel)) -labelsOnRepo' auth user repo = - executeRequestMaybe auth $ labelsOnRepoR user repo FetchAll - -- | List all labels for this repository. -- See labelsOnRepoR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector IssueLabel) labelsOnRepoR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "labels"] [] --- | A label by name. --- --- > label "thoughtbot" "paperclip" "bug" -label :: Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error IssueLabel) -label = label' Nothing - --- | A label by name using authentication. --- --- > label' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bug" -label' :: Maybe Auth -> Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error IssueLabel) -label' auth user repo lbl = - executeRequestMaybe auth $ labelR user repo lbl - -- | Query a single label. -- See labelR :: Name Owner -> Name Repo -> Name IssueLabel -> Request k IssueLabel labelR user repo lbl = query ["repos", toPathPart user, toPathPart repo, "labels", toPathPart lbl] [] --- | Create a label --- --- > createLabel (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bug" "f29513" -createLabel :: Auth -> Name Owner -> Name Repo -> Name IssueLabel -> String -> IO (Either Error IssueLabel) -createLabel auth user repo lbl color = - executeRequest auth $ createLabelR user repo lbl color - -- | Create a label. -- See createLabelR :: Name Owner -> Name Repo -> Name IssueLabel -> String -> Request 'RW IssueLabel @@ -94,19 +45,6 @@ createLabelR user repo lbl color = paths = ["repos", toPathPart user, toPathPart repo, "labels"] body = object ["name" .= untagName lbl, "color" .= color] --- | Update a label --- --- > updateLabel (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bug" "new-bug" "ff1111" -updateLabel :: Auth - -> Name Owner - -> Name Repo - -> Name IssueLabel -- ^ old label name - -> Name IssueLabel -- ^ new label name - -> String -- ^ new color - -> IO (Either Error IssueLabel) -updateLabel auth user repo oldLbl newLbl color = - executeRequest auth $ updateLabelR user repo oldLbl newLbl color - -- | Update a label. -- See updateLabelR :: Name Owner @@ -121,51 +59,18 @@ updateLabelR user repo oldLbl newLbl color = paths = ["repos", toPathPart user, toPathPart repo, "labels", toPathPart oldLbl] body = object ["name" .= untagName newLbl, "color" .= color] --- | Delete a label --- --- > deleteLabel (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "bug" -deleteLabel :: Auth -> Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error ()) -deleteLabel auth user repo lbl = - executeRequest auth $ deleteLabelR user repo lbl - -- | Delete a label. -- See deleteLabelR :: Name Owner -> Name Repo -> Name IssueLabel -> GenRequest 'MtUnit 'RW () deleteLabelR user repo lbl = Command Delete ["repos", toPathPart user, toPathPart repo, "labels", toPathPart lbl] mempty --- | The labels on an issue in a repo. --- --- > labelsOnIssue "thoughtbot" "paperclip" 585 -labelsOnIssue :: Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueLabel)) -labelsOnIssue = labelsOnIssue' Nothing - --- | The labels on an issue in a repo using authentication. --- --- > labelsOnIssue' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585) -labelsOnIssue' :: Maybe Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueLabel)) -labelsOnIssue' auth user repo iid = - executeRequestMaybe auth $ labelsOnIssueR user repo iid FetchAll - -- | List labels on an issue. -- See labelsOnIssueR :: Name Owner -> Name Repo -> Id Issue -> FetchCount -> Request k (Vector IssueLabel) labelsOnIssueR user repo iid = pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] [] --- | Add labels to an issue. --- --- > addLabelsToIssue (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585) ["Label1" "Label2"] -addLabelsToIssue :: Foldable f - => Auth - -> Name Owner - -> Name Repo - -> Id Issue - -> f (Name IssueLabel) - -> IO (Either Error (Vector IssueLabel)) -addLabelsToIssue auth user repo iid lbls = - executeRequest auth $ addLabelsToIssueR user repo iid lbls - -- | Add lables to an issue. -- See addLabelsToIssueR :: Foldable f @@ -179,32 +84,12 @@ addLabelsToIssueR user repo iid lbls = where paths = ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] --- | Remove a label from an issue. --- --- > removeLabelFromIssue (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585) "bug" -removeLabelFromIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> Name IssueLabel -> IO (Either Error ()) -removeLabelFromIssue auth user repo iid lbl = - executeRequest auth $ removeLabelFromIssueR user repo iid lbl - -- | Remove a label from an issue. -- See removeLabelFromIssueR :: Name Owner -> Name Repo -> Id Issue -> Name IssueLabel -> GenRequest 'MtUnit 'RW () removeLabelFromIssueR user repo iid lbl = Command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels", toPathPart lbl] mempty --- | Replace all labels on an issue. Sending an empty list will remove all labels from the issue. --- --- > replaceAllLabelsForIssue (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585) ["Label1" "Label2"] -replaceAllLabelsForIssue :: Foldable f - => Auth - -> Name Owner - -> Name Repo - -> Id Issue - -> f (Name IssueLabel) - -> IO (Either Error (Vector IssueLabel)) -replaceAllLabelsForIssue auth user repo iid lbls = - executeRequest auth $ replaceAllLabelsForIssueR user repo iid lbls - -- | Replace all labels on an issue. -- See -- @@ -220,32 +105,12 @@ replaceAllLabelsForIssueR user repo iid lbls = where paths = ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] --- | Remove all labels from an issue. --- --- > removeAllLabelsFromIssue (BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 585) -removeAllLabelsFromIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error ()) -removeAllLabelsFromIssue auth user repo iid = - executeRequest auth $ removeAllLabelsFromIssueR user repo iid - -- | Remove all labels from an issue. -- See removeAllLabelsFromIssueR :: Name Owner -> Name Repo -> Id Issue -> GenRequest 'MtUnit 'RW () removeAllLabelsFromIssueR user repo iid = Command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] mempty --- | All the labels on a repo's milestone given the milestone ID. --- --- > labelsOnMilestone "thoughtbot" "paperclip" (Id 2) -labelsOnMilestone :: Name Owner -> Name Repo -> Id Milestone -> IO (Either Error (Vector IssueLabel)) -labelsOnMilestone = labelsOnMilestone' Nothing - --- | All the labels on a repo's milestone given the milestone ID using authentication. --- --- > labelsOnMilestone' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 2) -labelsOnMilestone' :: Maybe Auth -> Name Owner -> Name Repo -> Id Milestone -> IO (Either Error (Vector IssueLabel)) -labelsOnMilestone' auth user repo mid = - executeRequestMaybe auth $ labelsOnMilestoneR user repo mid FetchAll - -- | Query labels for every issue in a milestone. -- See labelsOnMilestoneR :: Name Owner -> Name Repo -> Id Milestone -> FetchCount -> Request k (Vector IssueLabel) diff --git a/src/GitHub/Endpoints/Issues/Milestones.hs b/src/GitHub/Endpoints/Issues/Milestones.hs index 574d2a0e..78b6531d 100644 --- a/src/GitHub/Endpoints/Issues/Milestones.hs +++ b/src/GitHub/Endpoints/Issues/Milestones.hs @@ -6,78 +6,42 @@ -- The milestones API as described on -- . module GitHub.Endpoints.Issues.Milestones ( - milestones, - milestones', milestonesR, - milestone, milestoneR, - createMilestone, createMilestoneR, - updateMilestone, updateMilestoneR, - deleteMilestone, deleteMilestoneR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All milestones in the repo. --- --- > milestones "thoughtbot" "paperclip" -milestones :: Name Owner -> Name Repo -> IO (Either Error (Vector Milestone)) -milestones = milestones' Nothing - --- | All milestones in the repo, using authentication. --- --- > milestones' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -milestones' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Milestone)) -milestones' auth user repo = - executeRequestMaybe auth $ milestonesR user repo FetchAll - -- | List milestones for a repository. -- See milestonesR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Milestone) milestonesR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "milestones"] [] --- | Details on a specific milestone, given it's milestone number. --- --- > milestone "thoughtbot" "paperclip" (Id 2) -milestone :: Name Owner -> Name Repo -> Id Milestone -> IO (Either Error Milestone) -milestone user repo mid = - executeRequest' $ milestoneR user repo mid - -- | Query a single milestone. -- See milestoneR :: Name Owner -> Name Repo -> Id Milestone -> Request k Milestone milestoneR user repo mid = query ["repos", toPathPart user, toPathPart repo, "milestones", toPathPart mid] [] -createMilestone :: Auth -> Name Owner -> Name Repo -> NewMilestone -> IO (Either Error Milestone) -createMilestone auth user repo mlstn = executeRequest auth $ createMilestoneR user repo mlstn - -- | Create a milestone. -- See createMilestoneR :: Name Owner -> Name Repo -> NewMilestone -> Request 'RW Milestone createMilestoneR user repo = command Post ["repos", toPathPart user, toPathPart repo, "milestones"] . encode -updateMilestone :: Auth -> Name Owner -> Name Repo -> Id Milestone -> UpdateMilestone -> IO (Either Error Milestone) -updateMilestone auth user repo mid mlstn = executeRequest auth $ updateMilestoneR user repo mid mlstn - -- | Update a milestone. -- See updateMilestoneR :: Name Owner -> Name Repo -> Id Milestone -> UpdateMilestone -> Request 'RW Milestone updateMilestoneR user repo mid = command Patch ["repos", toPathPart user, toPathPart repo, "milestones", toPathPart mid ] . encode -deleteMilestone :: Auth -> Name Owner -> Name Repo -> Id Milestone -> IO (Either Error ()) -deleteMilestone auth user repo mid = executeRequest auth $ deleteMilestoneR user repo mid - -- | Delete a milestone. -- See deleteMilestoneR :: Name Owner -> Name Repo -> Id Milestone -> GenRequest 'MtUnit 'RW () diff --git a/src/GitHub/Endpoints/Organizations.hs b/src/GitHub/Endpoints/Organizations.hs index ee1f5557..12844510 100644 --- a/src/GitHub/Endpoints/Organizations.hs +++ b/src/GitHub/Endpoints/Organizations.hs @@ -5,11 +5,7 @@ -- -- The orgs API as described on . module GitHub.Endpoints.Organizations ( - publicOrganizationsFor, - publicOrganizationsFor', publicOrganizationsForR, - publicOrganization, - publicOrganization', publicOrganizationR, organizationsR, module GitHub.Data, @@ -17,22 +13,8 @@ module GitHub.Endpoints.Organizations ( import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | The public organizations for a user, given the user's login, with authorization --- --- > publicOrganizationsFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns" -publicOrganizationsFor' :: Maybe Auth -> Name User -> IO (Either Error (Vector SimpleOrganization)) -publicOrganizationsFor' auth org = - executeRequestMaybe auth $ publicOrganizationsForR org FetchAll - --- | List user organizations. The public organizations for a user, given the user's login. --- --- > publicOrganizationsFor "mike-burns" -publicOrganizationsFor :: Name User -> IO (Either Error (Vector SimpleOrganization)) -publicOrganizationsFor = publicOrganizationsFor' Nothing - -- | List all user organizations. -- See organizationsR :: FetchCount -> Request k (Vector SimpleOrganization) @@ -43,18 +25,6 @@ organizationsR = pagedQuery ["user", "orgs"] [] publicOrganizationsForR :: Name User -> FetchCount -> Request k (Vector SimpleOrganization) publicOrganizationsForR user = pagedQuery ["users", toPathPart user, "orgs"] [] --- | Details on a public organization. Takes the organization's login. --- --- > publicOrganization' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" -publicOrganization' :: Maybe Auth -> Name Organization -> IO (Either Error Organization) -publicOrganization' auth = executeRequestMaybe auth . publicOrganizationR - --- | Query an organization. Details on a public organization. Takes the organization's login. --- --- > publicOrganization "thoughtbot" -publicOrganization :: Name Organization -> IO (Either Error Organization) -publicOrganization = publicOrganization' Nothing - -- | Query an organization. -- See publicOrganizationR :: Name Organization -> Request k Organization diff --git a/src/GitHub/Endpoints/Organizations/Members.hs b/src/GitHub/Endpoints/Organizations/Members.hs index db952269..26a8f4c4 100644 --- a/src/GitHub/Endpoints/Organizations/Members.hs +++ b/src/GitHub/Endpoints/Organizations/Members.hs @@ -6,12 +6,8 @@ -- The organization members API as described on -- . module GitHub.Endpoints.Organizations.Members ( - membersOf, - membersOf', membersOfR, membersOfWithR, - isMemberOf, - isMemberOf', isMemberOfR, orgInvitationsR, module GitHub.Data, @@ -19,24 +15,8 @@ module GitHub.Endpoints.Organizations.Members ( import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All the users who are members of the specified organization, --- | with or without authentication. --- --- > membersOf' (Just $ OAuth "token") "thoughtbot" -membersOf' :: Maybe Auth -> Name Organization -> IO (Either Error (Vector SimpleUser)) -membersOf' auth org = - executeRequestMaybe auth $ membersOfR org FetchAll - --- | All the users who are members of the specified organization, --- | without authentication. --- --- > membersOf "thoughtbot" -membersOf :: Name Organization -> IO (Either Error (Vector SimpleUser)) -membersOf = membersOf' Nothing - -- | All the users who are members of the specified organization. -- -- See @@ -59,21 +39,6 @@ membersOfWithR org f r = OrgMemberRoleAdmin -> "admin" OrgMemberRoleMember -> "member" --- | Check if a user is a member of an organization, --- | with or without authentication. --- --- > isMemberOf' (Just $ OAuth "token") "phadej" "haskell-infra" -isMemberOf' :: Maybe Auth -> Name User -> Name Organization -> IO (Either Error Bool) -isMemberOf' auth user org = - executeRequestMaybe auth $ isMemberOfR user org - --- | Check if a user is a member of an organization, --- | without authentication. --- --- > isMemberOf "phadej" "haskell-infra" -isMemberOf :: Name User -> Name Organization -> IO (Either Error Bool) -isMemberOf = isMemberOf' Nothing - -- | Check if a user is a member of an organization. -- -- See diff --git a/src/GitHub/Endpoints/Organizations/Teams.hs b/src/GitHub/Endpoints/Organizations/Teams.hs index 3aa19401..189e68f7 100644 --- a/src/GitHub/Endpoints/Organizations/Teams.hs +++ b/src/GitHub/Endpoints/Organizations/Teams.hs @@ -6,122 +6,49 @@ -- The Owner teams API as described on -- . module GitHub.Endpoints.Organizations.Teams ( - teamsOf, - teamsOf', teamsOfR, - teamInfoFor, - teamInfoFor', teamInfoForR, - createTeamFor', createTeamForR, - editTeam', editTeamR, - deleteTeam', deleteTeamR, listTeamMembersR, - listTeamRepos, - listTeamRepos', listTeamReposR, - addOrUpdateTeamRepo', addOrUpdateTeamRepoR, - teamMembershipInfoFor, - teamMembershipInfoFor', teamMembershipInfoForR, - addTeamMembershipFor', addTeamMembershipForR, - deleteTeamMembershipFor', deleteTeamMembershipForR, - listTeamsCurrent', listTeamsCurrentR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | List teams. List the teams of an Owner. --- When authenticated, lists private teams visible to the authenticated user. --- When unauthenticated, lists only public teams for an Owner. --- --- > teamsOf' (Just $ OAuth "token") "thoughtbot" -teamsOf' :: Maybe Auth -> Name Organization -> IO (Either Error (Vector SimpleTeam)) -teamsOf' auth org = - executeRequestMaybe auth $ teamsOfR org FetchAll - --- | List the public teams of an Owner. --- --- > teamsOf "thoughtbot" -teamsOf :: Name Organization -> IO (Either Error (Vector SimpleTeam)) -teamsOf = teamsOf' Nothing - -- | List teams. -- See teamsOfR :: Name Organization -> FetchCount -> Request k (Vector SimpleTeam) teamsOfR org = pagedQuery ["orgs", toPathPart org, "teams"] [] --- | The information for a single team, by team id. --- With authentication --- --- > teamInfoFor' (Just $ OAuth "token") 1010101 -teamInfoFor' :: Maybe Auth -> Id Team -> IO (Either Error Team) -teamInfoFor' auth tid = - executeRequestMaybe auth $ teamInfoForR tid - --- | The information for a single team, by team id. --- --- > teamInfoFor' (Just $ OAuth "token") 1010101 -teamInfoFor :: Id Team -> IO (Either Error Team) -teamInfoFor = teamInfoFor' Nothing - -- | Query team. -- See teamInfoForR :: Id Team -> Request k Team teamInfoForR tid = query ["teams", toPathPart tid] [] --- | Create a team under an Owner --- --- > createTeamFor' (OAuth "token") "Owner" (CreateTeam "newteamname" "some description" [] PermssionPull) -createTeamFor' :: Auth - -> Name Organization - -> CreateTeam - -> IO (Either Error Team) -createTeamFor' auth org cteam = - executeRequest auth $ createTeamForR org cteam - -- | Create team. -- See createTeamForR :: Name Organization -> CreateTeam -> Request 'RW Team createTeamForR org cteam = command Post ["orgs", toPathPart org, "teams"] (encode cteam) --- | Edit a team, by id. --- --- > editTeamFor' -editTeam' :: Auth - -> Id Team - -> EditTeam - -> IO (Either Error Team) -editTeam' auth tid eteam = - executeRequest auth $ editTeamR tid eteam - -- | Edit team. -- See editTeamR :: Id Team -> EditTeam -> Request 'RW Team editTeamR tid eteam = command Patch ["teams", toPathPart tid] (encode eteam) --- | Delete a team, by id. --- --- > deleteTeam' (OAuth "token") 1010101 -deleteTeam' :: Auth -> Id Team -> IO (Either Error ()) -deleteTeam' auth tid = - executeRequest auth $ deleteTeamR tid - --- | Delete team. -- -- See deleteTeamR :: Id Team -> GenRequest 'MtUnit 'RW () @@ -140,90 +67,36 @@ listTeamMembersR tid r = TeamMemberRoleMaintainer -> "maintainer" TeamMemberRoleMember -> "member" --- | The repositories of a single team, by team id. --- With authentication --- --- > listTeamRepos' (Just $ GitHub.OAuth token) (GitHub.mkTeamId team_id) -listTeamRepos' :: Maybe Auth -> Id Team -> IO (Either Error (Vector Repo)) -listTeamRepos' auth tid = executeRequestMaybe auth $ listTeamReposR tid FetchAll - -- | Query team repositories. -- See listTeamReposR :: Id Team -> FetchCount -> Request k (Vector Repo) listTeamReposR tid = pagedQuery ["teams", toPathPart tid, "repos"] [] --- | Retrieve repositories for a team. --- --- > listTeamRepos (GitHub.mkTeamId team_id) -listTeamRepos :: Id Team -> IO (Either Error (Vector Repo)) -listTeamRepos = listTeamRepos' Nothing - --- | Add a repository to a team or update the permission on the repository. --- --- > addOrUpdateTeamRepo' (OAuth "token") 1010101 "mburns" (Just PermissionPull) -addOrUpdateTeamRepo' :: Auth -> Id Team -> Name Organization -> Name Repo -> Permission -> IO (Either Error ()) -addOrUpdateTeamRepo' auth tid org repo permission = - executeRequest auth $ addOrUpdateTeamRepoR tid org repo permission - -- | Add or update a team repository. -- See addOrUpdateTeamRepoR :: Id Team -> Name Organization -> Name Repo -> Permission -> GenRequest 'MtUnit 'RW () addOrUpdateTeamRepoR tid org repo permission = Command Put ["teams", toPathPart tid, "repos", toPathPart org, toPathPart repo] (encode $ AddTeamRepoPermission permission) --- | Retrieve team mebership information for a user. --- With authentication --- --- > teamMembershipInfoFor' (Just $ OAuth "token") 1010101 "mburns" -teamMembershipInfoFor' :: Maybe Auth -> Id Team -> Name Owner -> IO (Either Error TeamMembership) -teamMembershipInfoFor' auth tid user = - executeRequestMaybe auth $ teamMembershipInfoForR tid user - -- | Query team membership. -- See Name Owner -> Request k TeamMembership teamMembershipInfoForR tid user = query ["teams", toPathPart tid, "memberships", toPathPart user] [] --- | Retrieve team mebership information for a user. --- --- > teamMembershipInfoFor 1010101 "mburns" -teamMembershipInfoFor :: Id Team -> Name Owner -> IO (Either Error TeamMembership) -teamMembershipInfoFor = teamMembershipInfoFor' Nothing - --- | Add (or invite) a member to a team. --- --- > addTeamMembershipFor' (OAuth "token") 1010101 "mburns" RoleMember -addTeamMembershipFor' :: Auth -> Id Team -> Name Owner -> Role -> IO (Either Error TeamMembership) -addTeamMembershipFor' auth tid user role = - executeRequest auth $ addTeamMembershipForR tid user role - -- | Add team membership. -- See addTeamMembershipForR :: Id Team -> Name Owner -> Role -> Request 'RW TeamMembership addTeamMembershipForR tid user role = command Put ["teams", toPathPart tid, "memberships", toPathPart user] (encode $ CreateTeamMembership role) --- | Delete a member of a team. --- --- > deleteTeamMembershipFor' (OAuth "token") 1010101 "mburns" -deleteTeamMembershipFor' :: Auth -> Id Team -> Name Owner -> IO (Either Error ()) -deleteTeamMembershipFor' auth tid user = - executeRequest auth $ deleteTeamMembershipForR tid user - -- | Remove team membership. -- See deleteTeamMembershipForR :: Id Team -> Name Owner -> GenRequest 'MtUnit 'RW () deleteTeamMembershipForR tid user = Command Delete ["teams", toPathPart tid, "memberships", toPathPart user] mempty --- | List teams for current authenticated user --- --- > listTeamsCurrent' (OAuth "token") -listTeamsCurrent' :: Auth -> IO (Either Error (Vector Team)) -listTeamsCurrent' auth = executeRequest auth $ listTeamsCurrentR FetchAll - -- | List user teams. -- See listTeamsCurrentR :: FetchCount -> Request 'RA (Vector Team) diff --git a/src/GitHub/Endpoints/PullRequests.hs b/src/GitHub/Endpoints/PullRequests.hs index 88409839..7217e51b 100644 --- a/src/GitHub/Endpoints/PullRequests.hs +++ b/src/GitHub/Endpoints/PullRequests.hs @@ -6,55 +6,24 @@ -- The pull requests API as documented at -- . module GitHub.Endpoints.PullRequests ( - pullRequestsFor, - pullRequestsFor', pullRequestsForR, - pullRequest', - pullRequest, pullRequestR, - pullRequestDiff', - pullRequestDiff, pullRequestDiffR, - pullRequestPatch', - pullRequestPatch, pullRequestPatchR, - createPullRequest, createPullRequestR, - updatePullRequest, updatePullRequestR, - pullRequestCommits', - pullRequestCommitsIO, pullRequestCommitsR, - pullRequestFiles', - pullRequestFiles, pullRequestFilesR, - isPullRequestMerged, isPullRequestMergedR, - mergePullRequest, mergePullRequestR, module GitHub.Data ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () import Data.ByteString.Lazy (ByteString) --- | All open pull requests for the repo, by owner and repo name. --- --- > pullRequestsFor "rails" "rails" -pullRequestsFor :: Name Owner -> Name Repo -> IO (Either Error (Vector SimplePullRequest)) -pullRequestsFor user repo = - executeRequest' $ pullRequestsForR user repo mempty FetchAll - --- | All open pull requests for the repo, by owner and repo name. --- --- > pullRequestsFor "rails" "rails" -pullRequestsFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimplePullRequest)) -pullRequestsFor' auth user repo = - executeRequestMaybe auth $ pullRequestsForR user repo mempty FetchAll - -- | List pull requests. -- See pullRequestsForR @@ -67,71 +36,24 @@ pullRequestsForR user repo opts = pagedQuery ["repos", toPathPart user, toPathPart repo, "pulls"] (prModToQueryString opts) --- | Obtain the diff of a pull request --- See -pullRequestDiff' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString) -pullRequestDiff' auth user repo prid = - executeRequestMaybe auth $ pullRequestDiffR user repo prid - --- | Obtain the diff of a pull request --- See -pullRequestDiff :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString) -pullRequestDiff = pullRequestDiff' Nothing - -- | Query a single pull request to obtain the diff -- See pullRequestDiffR :: Name Owner -> Name Repo -> IssueNumber -> GenRequest 'MtDiff rw ByteString pullRequestDiffR user repo prid = Query ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid] [] --- | Obtain the patch of a pull request --- --- See -pullRequestPatch' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString) -pullRequestPatch' auth user repo prid = - executeRequestMaybe auth $ pullRequestPatchR user repo prid - --- | Obtain the patch of a pull request --- See -pullRequestPatch :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error ByteString) -pullRequestPatch = pullRequestPatch' Nothing - -- | Query a single pull request to obtain the patch -- See pullRequestPatchR :: Name Owner -> Name Repo -> IssueNumber -> GenRequest 'MtPatch rw ByteString pullRequestPatchR user repo prid = Query ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid] [] --- | A detailed pull request, which has much more information. This takes the --- repo owner and name along with the number assigned to the pull request. --- With authentification. --- --- > pullRequest' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 562 -pullRequest' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error PullRequest) -pullRequest' auth user repo prid = - executeRequestMaybe auth $ pullRequestR user repo prid - --- | A detailed pull request, which has much more information. This takes the --- repo owner and name along with the number assigned to the pull request. --- --- > pullRequest "thoughtbot" "paperclip" 562 -pullRequest :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error PullRequest) -pullRequest = pullRequest' Nothing - -- | Query a single pull request. -- See pullRequestR :: Name Owner -> Name Repo -> IssueNumber -> Request k PullRequest pullRequestR user repo prid = query ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid] [] -createPullRequest :: Auth - -> Name Owner - -> Name Repo - -> CreatePullRequest - -> IO (Either Error PullRequest) -createPullRequest auth user repo cpr = - executeRequest auth $ createPullRequestR user repo cpr - -- | Create a pull request. -- See createPullRequestR :: Name Owner @@ -141,11 +63,6 @@ createPullRequestR :: Name Owner createPullRequestR user repo cpr = command Post ["repos", toPathPart user, toPathPart repo, "pulls"] (encode cpr) --- | Update a pull request -updatePullRequest :: Auth -> Name Owner -> Name Repo -> IssueNumber -> EditPullRequest -> IO (Either Error PullRequest) -updatePullRequest auth user repo prid epr = - executeRequest auth $ updatePullRequestR user repo prid epr - -- | Update a pull request. -- See updatePullRequestR :: Name Owner @@ -156,66 +73,24 @@ updatePullRequestR :: Name Owner updatePullRequestR user repo prid epr = command Patch ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid] (encode epr) --- | All the commits on a pull request, given the repo owner, repo name, and --- the number of the pull request. --- With authentification. --- --- > pullRequestCommits' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 688 -pullRequestCommits' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector Commit)) -pullRequestCommits' auth user repo prid = - executeRequestMaybe auth $ pullRequestCommitsR user repo prid FetchAll - --- | All the commits on a pull request, given the repo owner, repo name, and --- the number of the pull request. --- --- > pullRequestCommits "thoughtbot" "paperclip" 688 -pullRequestCommitsIO :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector Commit)) -pullRequestCommitsIO = pullRequestCommits' Nothing - -- | List commits on a pull request. -- See pullRequestCommitsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector Commit) pullRequestCommitsR user repo prid = pagedQuery ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid, "commits"] [] --- | The individual files that a pull request patches. Takes the repo owner and --- name, plus the number assigned to the pull request. --- With authentification. --- --- > pullRequestFiles' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" 688 -pullRequestFiles' :: Maybe Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector File)) -pullRequestFiles' auth user repo prid = - executeRequestMaybe auth $ pullRequestFilesR user repo prid FetchAll - --- | The individual files that a pull request patches. Takes the repo owner and --- name, plus the number assigned to the pull request. --- --- > pullRequestFiles "thoughtbot" "paperclip" 688 -pullRequestFiles :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector File)) -pullRequestFiles = pullRequestFiles' Nothing - -- | List pull requests files. -- See pullRequestFilesR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector File) pullRequestFilesR user repo prid = pagedQuery ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid, "files"] [] --- | Check if pull request has been merged. -isPullRequestMerged :: Auth -> Name Owner -> Name Repo -> IssueNumber -> IO (Either Error Bool) -isPullRequestMerged auth user repo prid = - executeRequest auth $ isPullRequestMergedR user repo prid - -- | Query if a pull request has been merged. -- See isPullRequestMergedR :: Name Owner -> Name Repo -> IssueNumber -> GenRequest 'MtStatus rw Bool isPullRequestMergedR user repo prid = Query ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid, "merge"] [] --- | Merge a pull request. -mergePullRequest :: Auth -> Name Owner -> Name Repo -> IssueNumber -> Maybe Text -> IO (Either Error MergeResult) -mergePullRequest auth user repo prid commitMessage = - executeRequest auth $ mergePullRequestR user repo prid commitMessage - -- | Merge a pull request (Merge Button). -- https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button mergePullRequestR :: Name Owner -> Name Repo -> IssueNumber -> Maybe Text -> GenRequest 'MtStatus 'RW MergeResult diff --git a/src/GitHub/Endpoints/PullRequests/Comments.hs b/src/GitHub/Endpoints/PullRequests/Comments.hs index 52103030..889de642 100644 --- a/src/GitHub/Endpoints/PullRequests/Comments.hs +++ b/src/GitHub/Endpoints/PullRequests/Comments.hs @@ -6,55 +6,28 @@ -- The pull request review comments API as described at -- . module GitHub.Endpoints.PullRequests.Comments ( - pullRequestCommentsIO, pullRequestCommentsR, - pullRequestComment, pullRequestCommentR, - createPullComment, createPullCommentR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All the comments on a pull request with the given ID. --- --- > pullRequestComments "thoughtbot" "factory_girl" (Id 256) -pullRequestCommentsIO :: Name Owner -> Name Repo -> IssueNumber -> IO (Either Error (Vector Comment)) -pullRequestCommentsIO user repo prid = - executeRequest' $ pullRequestCommentsR user repo prid FetchAll - -- | List comments on a pull request. -- See pullRequestCommentsR :: Name Owner -> Name Repo -> IssueNumber -> FetchCount -> Request k (Vector Comment) pullRequestCommentsR user repo prid = pagedQuery ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart prid, "comments"] [] --- | One comment on a pull request, by the comment's ID. --- --- > pullRequestComment "thoughtbot" "factory_girl" (Id 301819) -pullRequestComment :: Name Owner -> Name Repo -> Id Comment -> IO (Either Error Comment) -pullRequestComment user repo cid = - executeRequest' $ pullRequestCommentR user repo cid - -- | Query a single comment. -- See pullRequestCommentR :: Name Owner -> Name Repo -> Id Comment -> Request k Comment pullRequestCommentR user repo cid = query ["repos", toPathPart user, toPathPart repo, "pulls", "comments", toPathPart cid] [] --- | Create a new comment. --- --- > createPullComment (BasicAuth "github-username" "github-password") user repo issue commit path position --- > "some words" -createPullComment :: Auth -> Name Owner -> Name Repo -> IssueNumber -> Text -> Text -> Int -> Text - -> IO (Either Error Comment) -createPullComment auth user repo iss commit path position body = - executeRequest auth $ createPullCommentR user repo iss commit path position body - -- | Create a comment. -- -- See diff --git a/src/GitHub/Endpoints/PullRequests/Reviews.hs b/src/GitHub/Endpoints/PullRequests/Reviews.hs index afbc158c..e5c42ac8 100644 --- a/src/GitHub/Endpoints/PullRequests/Reviews.hs +++ b/src/GitHub/Endpoints/PullRequests/Reviews.hs @@ -6,22 +6,14 @@ -- The reviews API as described on . module GitHub.Endpoints.PullRequests.Reviews ( pullRequestReviewsR - , pullRequestReviews - , pullRequestReviews' , pullRequestReviewR - , pullRequestReview - , pullRequestReview' , pullRequestReviewCommentsR - , pullRequestReviewCommentsIO - , pullRequestReviewCommentsIO' , module GitHub.Data ) where import GitHub.Data import GitHub.Data.Id (Id) import GitHub.Internal.Prelude -import GitHub.Request - (Request, executeRequest', executeRequestMaybe) import Prelude () -- | List reviews for a pull request. @@ -43,31 +35,6 @@ pullRequestReviewsR owner repo prid = ] [] --- | All reviews for a pull request given the repo owner, repo name and the pull --- request id. --- --- > pullRequestReviews "thoughtbot" "paperclip" (Id 101) -pullRequestReviews - :: Name Owner - -> Name Repo - -> IssueNumber - -> IO (Either Error (Vector Review)) -pullRequestReviews owner repo prid = - executeRequest' $ pullRequestReviewsR owner repo prid FetchAll - --- | All reviews for a pull request given the repo owner, repo name and the pull --- request id. With authentication. --- --- > pullRequestReviews' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" (Id 101) -pullRequestReviews' - :: Maybe Auth - -> Name Owner - -> Name Repo - -> IssueNumber - -> IO (Either Error (Vector Review)) -pullRequestReviews' auth owner repo pr = - executeRequestMaybe auth $ pullRequestReviewsR owner repo pr FetchAll - -- | Query a single pull request review. -- see pullRequestReviewR @@ -88,34 +55,6 @@ pullRequestReviewR owner repo prid rid = ] [] --- | A detailed review on a pull request given the repo owner, repo name, pull --- request id and review id. --- --- > pullRequestReview "thoughtbot" "factory_girl" (Id 301819) (Id 332) -pullRequestReview - :: Name Owner - -> Name Repo - -> IssueNumber - -> Id Review - -> IO (Either Error Review) -pullRequestReview owner repo prid rid = - executeRequest' $ pullRequestReviewR owner repo prid rid - --- | A detailed review on a pull request given the repo owner, repo name, pull --- request id and review id. With authentication. --- --- > pullRequestReview' (Just $ BasicAuth "github-username" "github-password") --- > "thoughtbot" "factory_girl" (Id 301819) (Id 332) -pullRequestReview' - :: Maybe Auth - -> Name Owner - -> Name Repo - -> IssueNumber - -> Id Review - -> IO (Either Error Review) -pullRequestReview' auth owner repo prid rid = - executeRequestMaybe auth $ pullRequestReviewR owner repo prid rid - -- | Query the comments for a single pull request review. -- see pullRequestReviewCommentsR @@ -136,30 +75,3 @@ pullRequestReviewCommentsR owner repo prid rid = , "comments" ] [] - --- | All comments for a review on a pull request given the repo owner, repo --- name, pull request id and review id. --- --- > pullRequestReviewComments "thoughtbot" "factory_girl" (Id 301819) (Id 332) -pullRequestReviewCommentsIO - :: Name Owner - -> Name Repo - -> IssueNumber - -> Id Review - -> IO (Either Error [ReviewComment]) -pullRequestReviewCommentsIO owner repo prid rid = - executeRequest' $ pullRequestReviewCommentsR owner repo prid rid - --- | All comments for a review on a pull request given the repo owner, repo --- name, pull request id and review id. With authentication. --- --- > pullRequestReviewComments' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "factory_girl" (Id 301819) (Id 332) -pullRequestReviewCommentsIO' - :: Maybe Auth - -> Name Owner - -> Name Repo - -> IssueNumber - -> Id Review - -> IO (Either Error [ReviewComment]) -pullRequestReviewCommentsIO' auth owner repo prid rid = - executeRequestMaybe auth $ pullRequestReviewCommentsR owner repo prid rid diff --git a/src/GitHub/Endpoints/RateLimit.hs b/src/GitHub/Endpoints/RateLimit.hs index d357fbe8..3bbe8c2f 100644 --- a/src/GitHub/Endpoints/RateLimit.hs +++ b/src/GitHub/Endpoints/RateLimit.hs @@ -7,26 +7,12 @@ -- . module GitHub.Endpoints.RateLimit ( rateLimitR, - rateLimit, - rateLimit', module GitHub.Data, ) where import GitHub.Data -import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | Get your current rate limit status (Note: Accessing this endpoint does not count against your rate limit.) --- With authentication. -rateLimit' :: Maybe Auth -> IO (Either Error RateLimit) -rateLimit' auth = executeRequestMaybe auth rateLimitR - --- | Get your current rate limit status (Note: Accessing this endpoint does not count against your rate limit.) --- Without authentication. -rateLimit :: IO (Either Error RateLimit) -rateLimit = rateLimit' Nothing - -- | Get your current rate limit status. -- rateLimitR :: Request k RateLimit diff --git a/src/GitHub/Endpoints/Repos.hs b/src/GitHub/Endpoints/Repos.hs index 921204d5..38fe1e6f 100644 --- a/src/GitHub/Endpoints/Repos.hs +++ b/src/GitHub/Endpoints/Repos.hs @@ -7,46 +7,24 @@ -- module GitHub.Endpoints.Repos ( -- * Querying repositories - currentUserRepos, currentUserReposR, - userRepos, - userRepos', userReposR, - organizationRepos, - organizationRepos', organizationReposR, - repository, - repository', repositoryR, - contributors, - contributors', contributorsR, - contributorsWithAnonymous, - contributorsWithAnonymous', - languagesFor, - languagesFor', languagesForR, - tagsFor, - tagsFor', tagsForR, - branchesFor, - branchesFor', branchesForR, -- ** Create - createRepo', createRepoR, - createOrganizationRepo', createOrganizationRepoR, - forkExistingRepo', forkExistingRepoR, -- ** Edit - editRepo, editRepoR, -- ** Delete - deleteRepo, deleteRepoR, -- * Data @@ -55,7 +33,6 @@ module GitHub.Endpoints.Repos ( import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () repoPublicityQueryString :: RepoPublicity -> QueryString @@ -65,11 +42,6 @@ repoPublicityQueryString RepoPublicityMember = [("type", Just "member")] repoPublicityQueryString RepoPublicityPublic = [("type", Just "public")] repoPublicityQueryString RepoPublicityPrivate = [("type", Just "private")] --- | List your repositories. -currentUserRepos :: Auth -> RepoPublicity -> IO (Either Error (Vector Repo)) -currentUserRepos auth publicity = - executeRequest auth $ currentUserReposR publicity FetchAll - -- | List your repositories. -- See currentUserReposR :: RepoPublicity -> FetchCount -> Request k (Vector Repo) @@ -78,25 +50,6 @@ currentUserReposR publicity = where qs = repoPublicityQueryString publicity --- | The repos for a user, by their login. Can be restricted to just repos they --- own, are a member of, or publicize. Private repos will return empty list. --- --- > userRepos "mike-burns" All -userRepos :: Name Owner -> RepoPublicity -> IO (Either Error (Vector Repo)) -userRepos = userRepos' Nothing - --- | The repos for a user, by their login. --- With authentication. --- --- > userRepos' (Just $ BasicAuth "github-username" "github-password") "mike-burns" All -userRepos' - :: Maybe Auth - -> Name Owner - -> RepoPublicity - -> IO (Either Error (Vector Repo)) -userRepos' auth user publicity = - executeRequestMaybe auth $ userReposR user publicity FetchAll - -- | List user repositories. -- See userReposR :: Name Owner -> RepoPublicity -> FetchCount -> Request k(Vector Repo) @@ -105,24 +58,6 @@ userReposR user publicity = where qs = repoPublicityQueryString publicity --- | The repos for an organization, by the organization name. --- --- > organizationRepos "thoughtbot" -organizationRepos :: Name Organization -> IO (Either Error (Vector Repo)) -organizationRepos org = organizationRepos' Nothing org RepoPublicityAll - --- | The repos for an organization, by the organization name. --- With authentication. --- --- > organizationRepos (Just $ BasicAuth "github-username" "github-password") "thoughtbot" All -organizationRepos' - :: Maybe Auth - -> Name Organization - -> RepoPublicity - -> IO (Either Error (Vector Repo)) -organizationRepos' auth org publicity = - executeRequestMaybe auth $ organizationReposR org publicity FetchAll - -- | List organization repositories. -- See organizationReposR @@ -135,44 +70,18 @@ organizationReposR org publicity = where qs = repoPublicityQueryString publicity --- | Details on a specific repo, given the owner and repo name. --- --- > repository "mike-burns" "github" -repository :: Name Owner -> Name Repo -> IO (Either Error Repo) -repository = repository' Nothing - --- | Details on a specific repo, given the owner and repo name. --- With authentication. --- --- > repository' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github" -repository' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error Repo) -repository' auth user repo = - executeRequestMaybe auth $ repositoryR user repo - -- | Query single repository. -- See repositoryR :: Name Owner -> Name Repo -> Request k Repo repositoryR user repo = query ["repos", toPathPart user, toPathPart repo] [] --- | Create a new repository. --- --- > createRepo' (BasicAuth (user, password)) (newRepo "some_repo") {newRepoHasIssues = Just False} -createRepo' :: Auth -> NewRepo -> IO (Either Error Repo) -createRepo' auth nrepo = - executeRequest auth $ createRepoR nrepo - -- | Create a new repository. -- See createRepoR :: NewRepo -> Request 'RW Repo createRepoR nrepo = command Post ["user", "repos"] (encode nrepo) --- | Fork an existing repository. -forkExistingRepo' :: Auth -> Name Owner -> Name Repo -> Maybe (Name Owner) -> IO (Either Error Repo) -forkExistingRepo' auth owner repo morg = - executeRequest auth $ forkExistingRepoR owner repo morg - -- | Fork an existing repository. -- See -- TODO: The third paramater (an optional Organisation) is not used yet. @@ -180,32 +89,12 @@ forkExistingRepoR :: Name Owner -> Name Repo -> Maybe (Name Owner) -> Request 'R forkExistingRepoR owner repo _morg = command Post ["repos", toPathPart owner, toPathPart repo, "forks" ] mempty --- | Create a new repository for an organization. --- --- > createOrganizationRepo (BasicAuth (user, password)) "thoughtbot" (newRepo "some_repo") {newRepoHasIssues = Just False} -createOrganizationRepo' :: Auth -> Name Organization -> NewRepo -> IO (Either Error Repo) -createOrganizationRepo' auth org nrepo = - executeRequest auth $ createOrganizationRepoR org nrepo - -- | Create a new repository for an organization. -- See createOrganizationRepoR :: Name Organization -> NewRepo -> Request 'RW Repo createOrganizationRepoR org nrepo = command Post ["orgs", toPathPart org, "repos"] (encode nrepo) --- | Edit an existing repository. --- --- > editRepo (BasicAuth (user, password)) "some_user" "some_repo" def {editDescription = Just "some description"} -editRepo - :: Auth - -> Name Owner -- ^ owner - -> Name Repo -- ^ repository name - -> EditRepo - -> IO (Either Error Repo) -editRepo auth user repo body = - executeRequest auth $ editRepoR user repo body - - -- | Edit an existing repository. -- See editRepoR :: Name Owner -> Name Repo -> EditRepo -> Request 'RW Repo @@ -215,20 +104,6 @@ editRepoR user repo body = -- if no name is given, use curent name b = body {editName = editName body <|> Just repo} --- | The contributors to a repo, given the owner and repo name. --- --- > contributors "thoughtbot" "paperclip" -contributors :: Name Owner -> Name Repo -> IO (Either Error (Vector Contributor)) -contributors = contributors' Nothing - --- | The contributors to a repo, given the owner and repo name. --- With authentication. --- --- > contributors' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -contributors' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Contributor)) -contributors' auth user repo = - executeRequestMaybe auth $ contributorsR user repo False FetchAll - -- | List contributors. -- See contributorsR @@ -243,93 +118,24 @@ contributorsR user repo anon = qs | anon = [("anon", Just "true")] | otherwise = [] --- | The contributors to a repo, including anonymous contributors (such as --- deleted users or git commits with unknown email addresses), given the owner --- and repo name. --- --- > contributorsWithAnonymous "thoughtbot" "paperclip" -contributorsWithAnonymous :: Name Owner -> Name Repo -> IO (Either Error (Vector Contributor)) -contributorsWithAnonymous = contributorsWithAnonymous' Nothing - --- | The contributors to a repo, including anonymous contributors (such as --- deleted users or git commits with unknown email addresses), given the owner --- and repo name. --- With authentication. --- --- > contributorsWithAnonymous' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -contributorsWithAnonymous' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Contributor)) -contributorsWithAnonymous' auth user repo = - executeRequestMaybe auth $ contributorsR user repo True FetchAll - --- | The programming languages used in a repo along with the number of --- characters written in that language. Takes the repo owner and name. --- --- > languagesFor "mike-burns" "ohlaunch" -languagesFor :: Name Owner -> Name Repo -> IO (Either Error Languages) -languagesFor = languagesFor' Nothing - --- | The programming languages used in a repo along with the number of --- characters written in that language. Takes the repo owner and name. --- With authentication. --- --- > languagesFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "ohlaunch" -languagesFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error Languages) -languagesFor' auth user repo = - executeRequestMaybe auth $ languagesForR user repo - -- | List languages. -- See languagesForR :: Name Owner -> Name Repo -> Request k Languages languagesForR user repo = query ["repos", toPathPart user, toPathPart repo, "languages"] [] --- | The git tags on a repo, given the repo owner and name. --- --- > tagsFor "thoughtbot" "paperclip" -tagsFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Tag)) -tagsFor = tagsFor' Nothing - --- | The git tags on a repo, given the repo owner and name. --- With authentication. --- --- > tagsFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -tagsFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Tag)) -tagsFor' auth user repo = - executeRequestMaybe auth $ tagsForR user repo FetchAll - -- | List tags. -- See tagsForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Tag) tagsForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "tags"] [] --- | The git branches on a repo, given the repo owner and name. --- --- > branchesFor "thoughtbot" "paperclip" -branchesFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Branch)) -branchesFor = branchesFor' Nothing - --- | The git branches on a repo, given the repo owner and name. --- With authentication. --- --- > branchesFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -branchesFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Branch)) -branchesFor' auth user repo = - executeRequestMaybe auth $ branchesForR user repo FetchAll - -- | List branches. -- See branchesForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Branch) branchesForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "branches"] [] --- | Delete an existing repository. --- --- > deleteRepo (BasicAuth (user, password)) "thoughtbot" "some_repo" -deleteRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ()) -deleteRepo auth user repo = - executeRequest auth $ deleteRepoR user repo - -- | Delete a repository,. -- See deleteRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW () diff --git a/src/GitHub/Endpoints/Repos/Collaborators.hs b/src/GitHub/Endpoints/Repos/Collaborators.hs index ac0d9c0e..bc5680c6 100644 --- a/src/GitHub/Endpoints/Repos/Collaborators.hs +++ b/src/GitHub/Endpoints/Repos/Collaborators.hs @@ -6,53 +6,22 @@ -- The repo collaborators API as described on -- . module GitHub.Endpoints.Repos.Collaborators ( - collaboratorsOn, - collaboratorsOn', collaboratorsOnR, - isCollaboratorOn, isCollaboratorOnR, - addCollaborator, addCollaboratorR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All the users who have collaborated on a repo. --- --- > collaboratorsOn "thoughtbot" "paperclip" -collaboratorsOn :: Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser)) -collaboratorsOn = collaboratorsOn' Nothing - --- | All the users who have collaborated on a repo. --- With authentication. -collaboratorsOn' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser)) -collaboratorsOn' auth user repo = - executeRequestMaybe auth $ collaboratorsOnR user repo FetchAll - -- | List collaborators. -- See collaboratorsOnR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector SimpleUser) collaboratorsOnR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "collaborators"] [] --- | Whether the user is collaborating on a repo. Takes the user in question, --- the user who owns the repo, and the repo name. --- --- > isCollaboratorOn Nothing "mike-burns" "thoughtbot" "paperclip" --- > isCollaboratorOn Nothing "johnson" "thoughtbot" "paperclip" -isCollaboratorOn - :: Maybe Auth - -> Name Owner -- ^ Repository owner - -> Name Repo -- ^ Repository name - -> Name User -- ^ Collaborator? - -> IO (Either Error Bool) -isCollaboratorOn auth user repo coll = - executeRequestMaybe auth $ isCollaboratorOnR user repo coll - -- | Check if a user is a collaborator. -- See isCollaboratorOnR @@ -63,15 +32,6 @@ isCollaboratorOnR isCollaboratorOnR user repo coll = Query ["repos", toPathPart user, toPathPart repo, "collaborators", toPathPart coll] [] -addCollaborator - :: Auth - -> Name Owner -- ^ Repository owner - -> Name Repo -- ^ Repository name - -> Name User -- ^ Collaborator to add - -> IO (Either Error (Maybe RepoInvitation)) -addCollaborator auth owner repo coll = - executeRequest auth $ addCollaboratorR owner repo coll - -- | Invite a user as a collaborator. -- See addCollaboratorR diff --git a/src/GitHub/Endpoints/Repos/Comments.hs b/src/GitHub/Endpoints/Repos/Comments.hs index 5adcf814..2b853c0e 100644 --- a/src/GitHub/Endpoints/Repos/Comments.hs +++ b/src/GitHub/Endpoints/Repos/Comments.hs @@ -7,76 +7,28 @@ -- The repo commits API as described on -- . module GitHub.Endpoints.Repos.Comments ( - commentsFor, - commentsFor', commentsForR, - commitCommentsFor, - commitCommentsFor', commitCommentsForR, - commitCommentFor, - commitCommentFor', commitCommentForR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All the comments on a Github repo. --- --- > commentsFor "thoughtbot" "paperclip" -commentsFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Comment)) -commentsFor = commentsFor' Nothing - --- | All the comments on a Github repo. --- With authentication. --- --- > commentsFor "thoughtbot" "paperclip" -commentsFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Comment)) -commentsFor' auth user repo = - executeRequestMaybe auth $ commentsForR user repo FetchAll - -- | List commit comments for a repository. -- See commentsForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Comment) commentsForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "comments"] [] --- | Just the comments on a specific SHA for a given Github repo. --- --- > commitCommentsFor "thoughtbot" "paperclip" "41f685f6e01396936bb8cd98e7cca517e2c7d96b" -commitCommentsFor :: Name Owner -> Name Repo -> Name Commit -> IO (Either Error (Vector Comment)) -commitCommentsFor = commitCommentsFor' Nothing - --- | Just the comments on a specific SHA for a given Github repo. --- With authentication. --- --- > commitCommentsFor "thoughtbot" "paperclip" "41f685f6e01396936bb8cd98e7cca517e2c7d96b" -commitCommentsFor' :: Maybe Auth -> Name Owner -> Name Repo -> Name Commit -> IO (Either Error (Vector Comment)) -commitCommentsFor' auth user repo sha = - executeRequestMaybe auth $ commitCommentsForR user repo sha FetchAll - -- | List comments for a single commit. -- See commitCommentsForR :: Name Owner -> Name Repo -> Name Commit -> FetchCount -> Request k (Vector Comment) commitCommentsForR user repo sha = pagedQuery ["repos", toPathPart user, toPathPart repo, "commits", toPathPart sha, "comments"] [] --- | A comment, by its ID, relative to the Github repo. --- --- > commitCommentFor "thoughtbot" "paperclip" "669575" -commitCommentFor :: Name Owner -> Name Repo -> Id Comment -> IO (Either Error Comment) -commitCommentFor = commitCommentFor' Nothing - --- | A comment, by its ID, relative to the Github repo. --- --- > commitCommentFor "thoughtbot" "paperclip" "669575" -commitCommentFor' :: Maybe Auth -> Name Owner -> Name Repo -> Id Comment -> IO (Either Error Comment) -commitCommentFor' auth user repo cid = - executeRequestMaybe auth $ commitCommentForR user repo cid - -- | Query a single commit comment. -- See commitCommentForR :: Name Owner -> Name Repo -> Id Comment -> Request k Comment diff --git a/src/GitHub/Endpoints/Repos/Commits.hs b/src/GitHub/Endpoints/Repos/Commits.hs index affa5044..bfe0cc84 100644 --- a/src/GitHub/Endpoints/Repos/Commits.hs +++ b/src/GitHub/Endpoints/Repos/Commits.hs @@ -8,24 +8,15 @@ -- . module GitHub.Endpoints.Repos.Commits ( CommitQueryOption(..), - commitsFor, - commitsFor', commitsForR, - commitsWithOptionsFor, - commitsWithOptionsFor', commitsWithOptionsForR, - commit, - commit', commitR, - diff, - diff', diffR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () import qualified Data.ByteString as BS @@ -39,37 +30,11 @@ renderCommitQueryOption (CommitQueryAuthor author) = ("author", Just $ TE.encode renderCommitQueryOption (CommitQuerySince date) = ("since", Just $ TE.encodeUtf8 . T.pack $ formatISO8601 date) renderCommitQueryOption (CommitQueryUntil date) = ("until", Just $ TE.encodeUtf8 . T.pack $ formatISO8601 date) --- | The commit history for a repo. --- --- > commitsFor "mike-burns" "github" -commitsFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Commit)) -commitsFor = commitsFor' Nothing - --- | The commit history for a repo. --- With authentication. --- --- > commitsFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github" -commitsFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Commit)) -commitsFor' auth user repo = - commitsWithOptionsFor' auth user repo [] - -- | List commits on a repository. -- See commitsForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Commit) commitsForR user repo limit = commitsWithOptionsForR user repo limit [] -commitsWithOptionsFor :: Name Owner -> Name Repo -> [CommitQueryOption] -> IO (Either Error (Vector Commit)) -commitsWithOptionsFor = commitsWithOptionsFor' Nothing - --- | The commit history for a repo, with commits filtered to satisfy a list of --- query options. --- With authentication. --- --- > commitsWithOptionsFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github" [CommitQueryAuthor "djeik"] -commitsWithOptionsFor' :: Maybe Auth -> Name Owner -> Name Repo -> [CommitQueryOption] -> IO (Either Error (Vector Commit)) -commitsWithOptionsFor' auth user repo opts = - executeRequestMaybe auth $ commitsWithOptionsForR user repo FetchAll opts - -- | List commits on a repository. -- See commitsWithOptionsForR :: Name Owner -> Name Repo -> FetchCount -> [CommitQueryOption] -> Request k (Vector Commit) @@ -78,40 +43,12 @@ commitsWithOptionsForR user repo limit opts = where qs = map renderCommitQueryOption opts - --- | Details on a specific SHA1 for a repo. --- --- > commit "mike-burns" "github" "9d1a9a361266c3c890b1108ad2fdf52f824b1b81" -commit :: Name Owner -> Name Repo -> Name Commit -> IO (Either Error Commit) -commit = commit' Nothing - --- | Details on a specific SHA1 for a repo. --- With authentication. --- --- > commit (Just $ BasicAuth "github-username" "github-password") "mike-burns" "github" "9d1a9a361266c3c890b1108ad2fdf52f824b1b81" -commit' :: Maybe Auth -> Name Owner -> Name Repo -> Name Commit -> IO (Either Error Commit) -commit' auth user repo sha = - executeRequestMaybe auth $ commitR user repo sha - -- | Query a single commit. -- See commitR :: Name Owner -> Name Repo -> Name Commit -> Request k Commit commitR user repo sha = query ["repos", toPathPart user, toPathPart repo, "commits", toPathPart sha] [] --- | The diff between two treeishes on a repo. --- --- > diff "thoughtbot" "paperclip" "41f685f6e01396936bb8cd98e7cca517e2c7d96b" "HEAD" -diff :: Name Owner -> Name Repo -> Name Commit -> Name Commit -> IO (Either Error Diff) -diff = diff' Nothing - --- | The diff between two treeishes on a repo. --- --- > diff "thoughtbot" "paperclip" "41f685f6e01396936bb8cd98e7cca517e2c7d96b" "HEAD" -diff' :: Maybe Auth -> Name Owner -> Name Repo -> Name Commit -> Name Commit -> IO (Either Error Diff) -diff' auth user repo base headref = - executeRequestMaybe auth $ diffR user repo base headref - -- | Compare two commits. -- See diffR :: Name Owner -> Name Repo -> Name Commit -> Name Commit -> Request k Diff diff --git a/src/GitHub/Endpoints/Repos/Contents.hs b/src/GitHub/Endpoints/Repos/Contents.hs index bc5a9ab6..55f48c99 100644 --- a/src/GitHub/Endpoints/Repos/Contents.hs +++ b/src/GitHub/Endpoints/Repos/Contents.hs @@ -7,26 +7,17 @@ -- module GitHub.Endpoints.Repos.Contents ( -- * Querying contents - contentsFor, - contentsFor', contentsForR, - readmeFor, - readmeFor', readmeForR, - archiveFor, - archiveFor', archiveForR, -- ** Create - createFile, createFileR, -- ** Update - updateFile, updateFileR, -- ** Delete - deleteFile, deleteFileR, module GitHub.Data @@ -34,27 +25,12 @@ module GitHub.Endpoints.Repos.Contents ( import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () import Data.Maybe (maybeToList) import qualified Data.Text.Encoding as TE import Network.URI (URI) --- | The contents of a file or directory in a repo, given the repo owner, name, and path to the file --- --- > contentsFor "thoughtbot" "paperclip" "README.md" -contentsFor :: Name Owner -> Name Repo -> Text -> Maybe Text -> IO (Either Error Content) -contentsFor = contentsFor' Nothing - --- | The contents of a file or directory in a repo, given the repo owner, name, and path to the file --- With Authentication --- --- > contentsFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" "README.md" Nothing -contentsFor' :: Maybe Auth -> Name Owner -> Name Repo -> Text -> Maybe Text -> IO (Either Error Content) -contentsFor' auth user repo path ref = - executeRequestMaybe auth $ contentsForR user repo path ref - contentsForR :: Name Owner -> Name Repo @@ -66,38 +42,10 @@ contentsForR user repo path ref = where qs = maybe [] (\r -> [("ref", Just . TE.encodeUtf8 $ r)]) ref --- | The contents of a README file in a repo, given the repo owner and name --- --- > readmeFor "thoughtbot" "paperclip" -readmeFor :: Name Owner -> Name Repo -> IO (Either Error Content) -readmeFor = readmeFor' Nothing - --- | The contents of a README file in a repo, given the repo owner and name --- With Authentication --- --- > readmeFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -readmeFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error Content) -readmeFor' auth user repo = - executeRequestMaybe auth $ readmeForR user repo - readmeForR :: Name Owner -> Name Repo -> Request k Content readmeForR user repo = query ["repos", toPathPart user, toPathPart repo, "readme"] [] --- | The archive of a repo, given the repo owner, name, and archive type --- --- > archiveFor "thoughtbot" "paperclip" ArchiveFormatTarball Nothing -archiveFor :: Name Owner -> Name Repo -> ArchiveFormat -> Maybe Text -> IO (Either Error URI) -archiveFor = archiveFor' Nothing - --- | The archive of a repo, given the repo owner, name, and archive type --- With Authentication --- --- > archiveFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" ArchiveFormatTarball Nothing -archiveFor' :: Maybe Auth -> Name Owner -> Name Repo -> ArchiveFormat -> Maybe Text -> IO (Either Error URI) -archiveFor' auth user repo path ref = - executeRequestMaybe auth $ archiveForR user repo path ref - -- | Get archive link. -- See archiveForR @@ -110,16 +58,6 @@ archiveForR user repo format ref = Query path [] where path = ["repos", toPathPart user, toPathPart repo, toPathPart format] <> maybeToList ref --- | Create a file. -createFile - :: Auth - -> Name Owner -- ^ owner - -> Name Repo -- ^ repository name - -> CreateFile - -> IO (Either Error ContentResult) -createFile auth user repo body = - executeRequest auth $ createFileR user repo body - -- | Create a file. -- See createFileR @@ -130,16 +68,6 @@ createFileR createFileR user repo body = command Put ["repos", toPathPart user, toPathPart repo, "contents", createFilePath body] (encode body) --- | Update a file. -updateFile - :: Auth - -> Name Owner -- ^ owner - -> Name Repo -- ^ repository name - -> UpdateFile - -> IO (Either Error ContentResult) -updateFile auth user repo body = - executeRequest auth $ updateFileR user repo body - -- | Update a file. -- See updateFileR @@ -150,16 +78,6 @@ updateFileR updateFileR user repo body = command Put ["repos", toPathPart user, toPathPart repo, "contents", updateFilePath body] (encode body) --- | Delete a file. -deleteFile - :: Auth - -> Name Owner -- ^ owner - -> Name Repo -- ^ repository name - -> DeleteFile - -> IO (Either Error ()) -deleteFile auth user repo body = - executeRequest auth $ deleteFileR user repo body - -- | Delete a file. -- See deleteFileR diff --git a/src/GitHub/Endpoints/Repos/DeployKeys.hs b/src/GitHub/Endpoints/Repos/DeployKeys.hs index f1080680..cddbf823 100644 --- a/src/GitHub/Endpoints/Repos/DeployKeys.hs +++ b/src/GitHub/Endpoints/Repos/DeployKeys.hs @@ -7,62 +7,38 @@ -- module GitHub.Endpoints.Repos.DeployKeys ( -- * Querying deploy keys - deployKeysFor', deployKeysForR, - deployKeyFor', deployKeyForR, -- ** Create - createRepoDeployKey', createRepoDeployKeyR, -- ** Delete - deleteRepoDeployKey', deleteRepoDeployKeyR, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | Querying deploy keys. -deployKeysFor' :: Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector RepoDeployKey)) -deployKeysFor' auth user repo = - executeRequest auth $ deployKeysForR user repo FetchAll - -- | Querying deploy keys. -- See deployKeysForR :: Name Owner -> Name Repo -> FetchCount -> Request 'RA (Vector RepoDeployKey) deployKeysForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "keys"] [] --- | Querying a deploy key -deployKeyFor' :: Auth -> Name Owner -> Name Repo -> Id RepoDeployKey -> IO (Either Error RepoDeployKey) -deployKeyFor' auth user repo keyId = - executeRequest auth $ deployKeyForR user repo keyId - -- | Querying a deploy key. -- See deployKeyForR :: Name Owner -> Name Repo -> Id RepoDeployKey -> Request 'RA RepoDeployKey deployKeyForR user repo keyId = query ["repos", toPathPart user, toPathPart repo, "keys", toPathPart keyId] [] --- | Create a deploy key -createRepoDeployKey' :: Auth -> Name Owner -> Name Repo -> NewRepoDeployKey -> IO (Either Error RepoDeployKey) -createRepoDeployKey' auth user repo key = - executeRequest auth $ createRepoDeployKeyR user repo key - -- | Create a deploy key. -- See . createRepoDeployKeyR :: Name Owner -> Name Repo -> NewRepoDeployKey -> Request 'RW RepoDeployKey createRepoDeployKeyR user repo key = command Post ["repos", toPathPart user, toPathPart repo, "keys"] (encode key) -deleteRepoDeployKey' :: Auth -> Name Owner -> Name Repo -> Id RepoDeployKey -> IO (Either Error ()) -deleteRepoDeployKey' auth user repo keyId = - executeRequest auth $ deleteRepoDeployKeyR user repo keyId - -- | Delete a deploy key. -- See deleteRepoDeployKeyR :: Name Owner -> Name Repo -> Id RepoDeployKey -> GenRequest 'MtUnit 'RW () diff --git a/src/GitHub/Endpoints/Repos/Forks.hs b/src/GitHub/Endpoints/Repos/Forks.hs index 5ca6ac14..f556e1f8 100644 --- a/src/GitHub/Endpoints/Repos/Forks.hs +++ b/src/GitHub/Endpoints/Repos/Forks.hs @@ -6,31 +6,14 @@ -- Hot forking action, as described at -- . module GitHub.Endpoints.Repos.Forks ( - forksFor, - forksFor', forksForR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All the repos that are forked off the given repo. --- --- > forksFor "thoughtbot" "paperclip" -forksFor :: Name Owner -> Name Repo -> IO (Either Error (Vector Repo)) -forksFor = forksFor' Nothing - --- | All the repos that are forked off the given repo. --- | With authentication --- --- > forksFor' (Just $ BasicAuth "github-username" "github-password") "thoughtbot" "paperclip" -forksFor' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Repo)) -forksFor' auth user repo = - executeRequestMaybe auth $ forksForR user repo FetchAll - -- | List forks. -- See forksForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Repo) diff --git a/src/GitHub/Endpoints/Repos/Releases.hs b/src/GitHub/Endpoints/Repos/Releases.hs index 9c0e4ed4..6c96bee1 100644 --- a/src/GitHub/Endpoints/Repos/Releases.hs +++ b/src/GitHub/Endpoints/Repos/Releases.hs @@ -1,96 +1,35 @@ -- The Release API, as described at -- . module GitHub.Endpoints.Repos.Releases ( - releases, - releases', releasesR, - release, - release', releaseR, - latestRelease, - latestRelease', latestReleaseR, - releaseByTagName, - releaseByTagName', releaseByTagNameR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All releases for the given repo. --- --- > releases "calleerlandsson" "pick" -releases :: Name Owner -> Name Repo -> IO (Either Error (Vector Release)) -releases = releases' Nothing - --- | All releases for the given repo with authentication. --- --- > releases' (Just $ BasicAuth "github-username" "github-password") "calleerlandsson" "pick" -releases' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector Release)) -releases' auth user repo = - executeRequestMaybe auth $ releasesR user repo FetchAll - -- | List releases for a repository. -- See releasesR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector Release) releasesR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "releases"] [] --- | Query a single release. --- --- > release "calleerlandsson" "pick" -release :: Name Owner -> Name Repo -> Id Release -> IO (Either Error Release) -release = release' Nothing - --- | Query a single release with authentication. --- --- > release' (Just $ BasicAuth "github-username" "github-password") "calleerlandsson" "pick" -release' :: Maybe Auth -> Name Owner -> Name Repo -> Id Release -> IO (Either Error Release) -release' auth user repo reqReleaseId = - executeRequestMaybe auth $ releaseR user repo reqReleaseId - -- | Get a single release. -- See releaseR :: Name Owner -> Name Repo -> Id Release -> Request k Release releaseR user repo reqReleaseId = query ["repos", toPathPart user, toPathPart repo, "releases", toPathPart reqReleaseId ] [] --- | Query latest release. --- --- > latestRelease "calleerlandsson" "pick" -latestRelease :: Name Owner -> Name Repo -> IO (Either Error Release) -latestRelease = latestRelease' Nothing - --- | Query latest release with authentication. --- --- > latestRelease' (Just $ BasicAuth "github-username" "github-password") "calleerlandsson" "pick" -latestRelease' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error Release) -latestRelease' auth user repo = - executeRequestMaybe auth $ latestReleaseR user repo - -- | Get the latest release. -- See latestReleaseR :: Name Owner -> Name Repo -> Request k Release latestReleaseR user repo = query ["repos", toPathPart user, toPathPart repo, "releases", "latest" ] [] --- | Query release by tag name. --- --- > releaseByTagName "calleerlandsson" "pick" -releaseByTagName :: Name Owner -> Name Repo -> Text -> IO (Either Error Release) -releaseByTagName = releaseByTagName' Nothing - --- | Query release by tag name with authentication. --- --- > releaseByTagName' (Just $ BasicAuth "github-username" "github-password") "calleerlandsson" "pick" -releaseByTagName' :: Maybe Auth -> Name Owner -> Name Repo -> Text -> IO (Either Error Release) -releaseByTagName' auth user repo reqTagName = - executeRequestMaybe auth $ releaseByTagNameR user repo reqTagName - -- | Get a release by tag name -- See releaseByTagNameR :: Name Owner -> Name Repo -> Text -> Request k Release diff --git a/src/GitHub/Endpoints/Repos/Statuses.hs b/src/GitHub/Endpoints/Repos/Statuses.hs index d25186d6..1c1f167d 100644 --- a/src/GitHub/Endpoints/Repos/Statuses.hs +++ b/src/GitHub/Endpoints/Repos/Statuses.hs @@ -6,29 +6,16 @@ -- The repo statuses API as described on -- . module GitHub.Endpoints.Repos.Statuses ( - createStatus, createStatusR, - statusesFor, statusesForR, - statusFor, statusForR, module GitHub.Data ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | Create a new status --- --- > createStatus (BasicAuth user password) "thoughtbot" "paperclip" --- > "41f685f6e01396936bb8cd98e7cca517e2c7d96b" --- > (NewStatus StatusSuccess Nothing "Looks good!" Nothing) -createStatus :: Auth -> Name Owner -> Name Repo -> Name Commit -> NewStatus -> IO (Either Error Status) -createStatus auth owner repo sha ns = - executeRequest auth $ createStatusR owner repo sha ns - -- | Create a new status -- See createStatusR :: Name Owner -> Name Repo -> Name Commit -> NewStatus -> Request 'RW Status @@ -37,28 +24,12 @@ createStatusR owner repo sha = where parts = ["repos", toPathPart owner, toPathPart repo, "statuses", toPathPart sha] --- | All statuses for a commit --- --- > statusesFor (BasicAuth user password) "thoughtbot" "paperclip" --- > "41f685f6e01396936bb8cd98e7cca517e2c7d96b" -statusesFor :: Auth -> Name Owner -> Name Repo -> Name Commit -> IO (Either Error (Vector Status)) -statusesFor auth user repo sha = - executeRequest auth $ statusesForR user repo sha FetchAll - -- | All statuses for a commit -- See statusesForR :: Name Owner -> Name Repo -> Name Commit -> FetchCount -> Request 'RW (Vector Status) statusesForR user repo sha = pagedQuery ["repos", toPathPart user, toPathPart repo, "commits", toPathPart sha, "statuses"] [] --- | The combined status for a specific commit --- --- > statusFor (BasicAuth user password) "thoughtbot" "paperclip" --- > "41f685f6e01396936bb8cd98e7cca517e2c7d96b" -statusFor :: Auth -> Name Owner -> Name Repo -> Name Commit -> IO (Either Error CombinedStatus) -statusFor auth user repo sha = - executeRequest auth $ statusForR user repo sha - -- | The combined status for a specific commit -- See statusForR :: Name Owner -> Name Repo -> Name Commit -> Request 'RW CombinedStatus diff --git a/src/GitHub/Endpoints/Repos/Webhooks.hs b/src/GitHub/Endpoints/Repos/Webhooks.hs index 87e37fba..8b828f30 100644 --- a/src/GitHub/Endpoints/Repos/Webhooks.hs +++ b/src/GitHub/Endpoints/Repos/Webhooks.hs @@ -8,99 +8,61 @@ -- module GitHub.Endpoints.Repos.Webhooks ( -- * Querying repositories - webhooksFor', webhooksForR, - webhookFor', webhookForR, -- ** Create - createRepoWebhook', createRepoWebhookR, -- ** Edit - editRepoWebhook', editRepoWebhookR, -- ** Test - testPushRepoWebhook', testPushRepoWebhookR, - pingRepoWebhook', pingRepoWebhookR, -- ** Delete - deleteRepoWebhook', deleteRepoWebhookR, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () -webhooksFor' :: Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector RepoWebhook)) -webhooksFor' auth user repo = - executeRequest auth $ webhooksForR user repo FetchAll - -- | List hooks. -- See webhooksForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector RepoWebhook) webhooksForR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "hooks"] [] - -webhookFor' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> IO (Either Error RepoWebhook) -webhookFor' auth user repo hookId = - executeRequest auth $ webhookForR user repo hookId - --- | Query single hook. -- See webhookForR :: Name Owner -> Name Repo -> Id RepoWebhook -> Request k RepoWebhook webhookForR user repo hookId = query ["repos", toPathPart user, toPathPart repo, "hooks", toPathPart hookId] [] -createRepoWebhook' :: Auth -> Name Owner -> Name Repo -> NewRepoWebhook -> IO (Either Error RepoWebhook) -createRepoWebhook' auth user repo hook = - executeRequest auth $ createRepoWebhookR user repo hook - -- | Create a hook. -- See createRepoWebhookR :: Name Owner -> Name Repo -> NewRepoWebhook -> Request 'RW RepoWebhook createRepoWebhookR user repo hook = command Post ["repos", toPathPart user, toPathPart repo, "hooks"] (encode hook) -editRepoWebhook' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> EditRepoWebhook -> IO (Either Error RepoWebhook) -editRepoWebhook' auth user repo hookId hookEdit = - executeRequest auth $ editRepoWebhookR user repo hookId hookEdit - -- | Edit a hook. -- See editRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> EditRepoWebhook -> Request 'RW RepoWebhook editRepoWebhookR user repo hookId hookEdit = command Patch ["repos", toPathPart user, toPathPart repo, "hooks", toPathPart hookId] (encode hookEdit) -testPushRepoWebhook' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> IO (Either Error Bool) -testPushRepoWebhook' auth user repo hookId = - executeRequest auth $ testPushRepoWebhookR user repo hookId - -- | Test a push hook. -- See testPushRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtStatus 'RW Bool testPushRepoWebhookR user repo hookId = Command Post (createWebhookOpPath user repo hookId $ Just "tests") (encode ()) -pingRepoWebhook' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> IO (Either Error Bool) -pingRepoWebhook' auth user repo hookId = - executeRequest auth $ pingRepoWebhookR user repo hookId - -- | Ping a hook. -- See pingRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtStatus 'RW Bool pingRepoWebhookR user repo hookId = Command Post (createWebhookOpPath user repo hookId $ Just "pings") (encode ()) -deleteRepoWebhook' :: Auth -> Name Owner -> Name Repo -> Id RepoWebhook -> IO (Either Error ()) -deleteRepoWebhook' auth user repo hookId = - executeRequest auth $ deleteRepoWebhookR user repo hookId - -- | Delete a hook. -- See deleteRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtUnit 'RW () diff --git a/src/GitHub/Endpoints/Search.hs b/src/GitHub/Endpoints/Search.hs index 58a0e4e5..26c134bd 100644 --- a/src/GitHub/Endpoints/Search.hs +++ b/src/GitHub/Endpoints/Search.hs @@ -6,79 +6,30 @@ -- The Github Search API, as described at -- . module GitHub.Endpoints.Search( - searchRepos', - searchRepos, searchReposR, - searchCode', - searchCode, searchCodeR, - searchIssues', - searchIssues, searchIssuesR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () import qualified Data.Text.Encoding as TE --- | Perform a repository search. --- With authentication. --- --- > searchRepos' (Just $ BasicAuth "github-username" "github-password') "a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100" -searchRepos' :: Maybe Auth -> Text -> IO (Either Error (SearchResult Repo)) -searchRepos' auth = executeRequestMaybe auth . searchReposR - --- | Perform a repository search. --- Without authentication. --- --- > searchRepos "q=a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100" -searchRepos :: Text -> IO (Either Error (SearchResult Repo)) -searchRepos = searchRepos' Nothing - -- | Search repositories. -- See searchReposR :: Text -> Request k (SearchResult Repo) searchReposR searchString = query ["search", "repositories"] [("q", Just $ TE.encodeUtf8 searchString)] --- | Perform a code search. --- With authentication. --- --- > searchCode' (Just $ BasicAuth "github-username" "github-password') "a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100" -searchCode' :: Maybe Auth -> Text -> IO (Either Error (SearchResult Code)) -searchCode' auth = executeRequestMaybe auth . searchCodeR - --- | Perform a code search. --- Without authentication. --- --- > searchCode "q=addClass+in:file+language:js+repo:jquery/jquery" -searchCode :: Text -> IO (Either Error (SearchResult Code)) -searchCode = searchCode' Nothing - -- | Search code. -- See searchCodeR :: Text -> Request k (SearchResult Code) searchCodeR searchString = query ["search", "code"] [("q", Just $ TE.encodeUtf8 searchString)] --- | Perform an issue search. --- With authentication. --- --- > searchIssues' (Just $ BasicAuth "github-username" "github-password') "a repo%3Aphadej%2Fgithub&per_page=100" -searchIssues' :: Maybe Auth -> Text -> IO (Either Error (SearchResult Issue)) -searchIssues' auth = executeRequestMaybe auth . searchIssuesR - --- | Perform an issue search. --- Without authentication. --- --- > searchIssues "q=a repo%3Aphadej%2Fgithub&per_page=100" -searchIssues :: Text -> IO (Either Error (SearchResult Issue)) -searchIssues = searchIssues' Nothing - -- | Search issues. -- See searchIssuesR :: Text -> Request k (SearchResult Issue) diff --git a/src/GitHub/Endpoints/Users.hs b/src/GitHub/Endpoints/Users.hs index b3f7621c..ef68bba6 100644 --- a/src/GitHub/Endpoints/Users.hs +++ b/src/GitHub/Endpoints/Users.hs @@ -6,35 +6,24 @@ -- The Github Users API, as described at -- . module GitHub.Endpoints.Users ( - userInfoFor, - userInfoFor', userInfoForR, ownerInfoForR, - userInfoCurrent', userInfoCurrentR, module GitHub.Data, ) where import GitHub.Data -import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | The information for a single user, by login name. --- With authentification --- --- > userInfoFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns" -userInfoFor' :: Maybe Auth -> Name User -> IO (Either Error User) -userInfoFor' auth = executeRequestMaybe auth . userInfoForR - --- | The information for a single user, by login name. --- --- > userInfoFor "mike-burns" -userInfoFor :: Name User -> IO (Either Error User) -userInfoFor = executeRequest' . userInfoForR - -- | Query a single user. -- See +-- +-- >>> github' userInfoForR "mike-burns" +-- +-- or +-- +-- >>> github userInfoForR (OAuth "github-token") "mike-burns" +-- userInfoForR :: Name User -> Request k User userInfoForR user = query ["users", toPathPart user] [] @@ -43,13 +32,6 @@ userInfoForR user = query ["users", toPathPart user] [] ownerInfoForR :: Name Owner -> Request k Owner ownerInfoForR owner = query ["users", toPathPart owner] [] --- | Retrieve information about the user associated with the supplied authentication. --- --- > userInfoCurrent' (OAuth "...") -userInfoCurrent' :: Auth -> IO (Either Error User) -userInfoCurrent' auth = - executeRequest auth $ userInfoCurrentR - -- | Query the authenticated user. -- See userInfoCurrentR :: Request 'RA User diff --git a/src/GitHub/Endpoints/Users/Emails.hs b/src/GitHub/Endpoints/Users/Emails.hs index c432aae6..9ba76389 100644 --- a/src/GitHub/Endpoints/Users/Emails.hs +++ b/src/GitHub/Endpoints/Users/Emails.hs @@ -6,38 +6,21 @@ -- The user emails API as described on -- . module GitHub.Endpoints.Users.Emails ( - currentUserEmails', currentUserEmailsR, - currentUserPublicEmails', currentUserPublicEmailsR, module GitHub.Data, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | List email addresses for the authenticated user. --- --- > currentUserEmails' (OAuth "token") -currentUserEmails' :: Auth -> IO (Either Error (Vector Email)) -currentUserEmails' auth = - executeRequest auth $ currentUserEmailsR FetchAll - -- | List email addresses. -- See currentUserEmailsR :: FetchCount -> Request 'RA (Vector Email) currentUserEmailsR = pagedQuery ["user", "emails"] [] --- | List public email addresses for the authenticated user. --- --- > currentUserPublicEmails' (OAuth "token") -currentUserPublicEmails' :: Auth -> IO (Either Error (Vector Email)) -currentUserPublicEmails' auth = - executeRequest auth $ currentUserPublicEmailsR FetchAll - -- | List public email addresses. -- See currentUserPublicEmailsR :: FetchCount -> Request 'RA (Vector Email) diff --git a/src/GitHub/Endpoints/Users/Followers.hs b/src/GitHub/Endpoints/Users/Followers.hs index 8ab72ce4..db58900f 100644 --- a/src/GitHub/Endpoints/Users/Followers.hs +++ b/src/GitHub/Endpoints/Users/Followers.hs @@ -6,8 +6,6 @@ -- The user followers API as described on -- . module GitHub.Endpoints.Users.Followers ( - usersFollowing, - usersFollowedBy, usersFollowingR, usersFollowedByR, module GitHub.Data, @@ -15,29 +13,14 @@ module GitHub.Endpoints.Users.Followers ( import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | All the users following the given user. --- --- > usersFollowing "mike-burns" -usersFollowing :: Name User -> IO (Either Error (Vector SimpleUser)) -usersFollowing user = - executeRequest' $ usersFollowingR user FetchAll - -- | List followers of a user. -- See usersFollowingR :: Name User -> FetchCount -> Request k (Vector SimpleUser) usersFollowingR user = pagedQuery ["users", toPathPart user, "followers"] [] --- | All the users that the given user follows. --- --- > usersFollowedBy "mike-burns" -usersFollowedBy :: Name User -> IO (Either Error (Vector SimpleUser)) -usersFollowedBy user = - executeRequest' $ usersFollowedByR user FetchAll - -- | List users followed by another user. -- See usersFollowedByR :: Name User -> FetchCount -> Request k (Vector SimpleUser) diff --git a/src/GitHub/Endpoints/Users/PublicSSHKeys.hs b/src/GitHub/Endpoints/Users/PublicSSHKeys.hs index 0eb9a4ee..663e2641 100644 --- a/src/GitHub/Endpoints/Users/PublicSSHKeys.hs +++ b/src/GitHub/Endpoints/Users/PublicSSHKeys.hs @@ -7,75 +7,45 @@ -- module GitHub.Endpoints.Users.PublicSSHKeys ( -- * Querying public SSH keys - publicSSHKeys', publicSSHKeysR, - publicSSHKeysFor', publicSSHKeysForR, - publicSSHKey', publicSSHKeyR, -- ** Create - createUserPublicSSHKey', createUserPublicSSHKeyR, -- ** Delete - deleteUserPublicSSHKey', deleteUserPublicSSHKeyR, ) where import GitHub.Data import GitHub.Internal.Prelude -import GitHub.Request import Prelude () --- | Querying public SSH keys. -publicSSHKeysFor' :: Name Owner -> IO (Either Error (Vector PublicSSHKeyBasic)) -publicSSHKeysFor' user = - executeRequest' $ publicSSHKeysForR user FetchAll - -- | Querying public SSH keys. -- See publicSSHKeysForR :: Name Owner -> FetchCount -> Request 'RO (Vector PublicSSHKeyBasic) publicSSHKeysForR user = pagedQuery ["users", toPathPart user, "keys"] [] --- | Querying the authenticated users' public SSH keys -publicSSHKeys' :: Auth -> IO (Either Error (Vector PublicSSHKey)) -publicSSHKeys' auth = - executeRequest auth publicSSHKeysR - -- | Querying the authenticated users' public SSH keys -- See publicSSHKeysR :: Request 'RA (Vector PublicSSHKey) publicSSHKeysR = query ["user", "keys"] [] --- | Querying a public SSH key -publicSSHKey' :: Auth -> Id PublicSSHKey -> IO (Either Error PublicSSHKey) -publicSSHKey' auth keyId = - executeRequest auth $ publicSSHKeyR keyId - -- | Querying a public SSH key. -- See publicSSHKeyR :: Id PublicSSHKey -> Request 'RA PublicSSHKey publicSSHKeyR keyId = query ["user", "keys", toPathPart keyId] [] --- | Create a public SSH key -createUserPublicSSHKey' :: Auth -> NewPublicSSHKey -> IO (Either Error PublicSSHKey) -createUserPublicSSHKey' auth key = - executeRequest auth $ createUserPublicSSHKeyR key - -- | Create a public SSH key. -- See . createUserPublicSSHKeyR :: NewPublicSSHKey -> Request 'RW PublicSSHKey createUserPublicSSHKeyR key = command Post ["user", "keys"] (encode key) -deleteUserPublicSSHKey' :: Auth -> Id PublicSSHKey -> IO (Either Error ()) -deleteUserPublicSSHKey' auth keyId = - executeRequest auth $ deleteUserPublicSSHKeyR keyId - -- | Delete a public SSH key. -- See deleteUserPublicSSHKeyR :: Id PublicSSHKey -> GenRequest 'MtUnit 'RW () From 7f103113066c38b8c87f833ea8221e01227ac61f Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Wed, 27 Nov 2019 02:46:31 +0200 Subject: [PATCH 005/121] Remove some committed in haddock artifacts --- src/highlight.js | 27 ------------------------ src/style.css | 55 ------------------------------------------------ 2 files changed, 82 deletions(-) delete mode 100644 src/highlight.js delete mode 100644 src/style.css diff --git a/src/highlight.js b/src/highlight.js deleted file mode 100644 index 1e903bd0..00000000 --- a/src/highlight.js +++ /dev/null @@ -1,27 +0,0 @@ - -var highlight = function (on) { - return function () { - var links = document.getElementsByTagName('a'); - for (var i = 0; i < links.length; i++) { - var that = links[i]; - - if (this.href != that.href) { - continue; - } - - if (on) { - that.classList.add("hover-highlight"); - } else { - that.classList.remove("hover-highlight"); - } - } - } -}; - -window.onload = function () { - var links = document.getElementsByTagName('a'); - for (var i = 0; i < links.length; i++) { - links[i].onmouseover = highlight(true); - links[i].onmouseout = highlight(false); - } -}; diff --git a/src/style.css b/src/style.css deleted file mode 100644 index e83dc5ec..00000000 --- a/src/style.css +++ /dev/null @@ -1,55 +0,0 @@ -body { - background-color: #fdf6e3; -} - -.hs-identifier { - color: #073642; -} - -.hs-identifier.hs-var { -} - -.hs-identifier.hs-type { - color: #5f5faf; -} - -.hs-keyword { - color: #af005f; -} - -.hs-string, .hs-char { - color: #cb4b16; -} - -.hs-number { - color: #268bd2; -} - -.hs-operator { - color: #d33682; -} - -.hs-glyph, .hs-special { - color: #dc322f; -} - -.hs-comment { - color: #8a8a8a; -} - -.hs-pragma { - color: #2aa198; -} - -.hs-cpp { - color: #859900; -} - -a:link, a:visited { - text-decoration: none; - border-bottom: 1px solid #eee8d5; -} - -a:hover, a.hover-highlight { - background-color: #eee8d5; -} From dab2a747a1d20746a7701c2c968bc2d35bcfb1cd Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Wed, 27 Nov 2019 02:51:40 +0200 Subject: [PATCH 006/121] Bump version to 0.24 --- CHANGELOG.md | 19 ++++++++++++++++++- github.cabal | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa23d79e..cdc67227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +## Changes for 0.24 + +**Major change**: +Introduce `github` n-ary combinator to hoist `... -> Request rw res` +into `... -> IO (Either Error res)` (i.e. n-ary `executeRequest`). +With that in place drop `.. -> IO (Either Error res)` functions. + +This reduces symbol bloat in the library. +[#415](https://github.com/phadej/github/pull/415) + +- Remove double `withOpenSSL` + [#414](https://github.com/phadej/github/pull/414) +- Pull requests reviews API uses issue number + [#409](https://github.com/phadej/github/pull/409) +- Update `Repo`, `NewRepo` and `EditRepo` data types + [#407](https://github.com/phadej/github/pull/407) + ## Changes for 0.23 - Escape URI paths @@ -93,7 +110,7 @@ ## Changes for 0.18 -- Endpoints for deleting issue comments. +- Endpoints for deleting issue comments. [#294](https://github.com/phadej/github/pull/294) - Endpoints for (un)starring gists. [#296](https://github.com/phadej/github/pull/296) diff --git a/github.cabal b/github.cabal index ff5c3c2a..b3a18432 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: github -version: 0.23 +version: 0.24 synopsis: Access to the GitHub API, v3. category: Network description: From 01de4b16d2f1ef2aea3d437f1697ea5f318701bb Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Wed, 27 Nov 2019 14:35:13 +0200 Subject: [PATCH 007/121] Remove nix stuff --- default.nix | 3 --- overlay.nix | 31 ------------------------------- 2 files changed, 34 deletions(-) delete mode 100644 default.nix delete mode 100644 overlay.nix diff --git a/default.nix b/default.nix deleted file mode 100644 index e8e50a1b..00000000 --- a/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -let - pkgs = import { overlays = [ (import ./overlay.nix) ]; }; -in pkgs.haskellPackages.callCabal2nix "github" ./. { } diff --git a/overlay.nix b/overlay.nix deleted file mode 100644 index 173f195e..00000000 --- a/overlay.nix +++ /dev/null @@ -1,31 +0,0 @@ -_: pkgs: { - haskellPackages = pkgs.haskellPackages.override (old: { - overrides = pkgs.lib.composeExtensions (old.overrides or (_: _: {})) (self: super: { - unordered-containers = pkgs.haskell.lib.overrideCabal super.unordered-containers (_: { - version = "0.2.10.0"; - sha256 = "0wy5hfrs880hh8hvp648bl07ws777n3kkmczzdszr7papnyigwb5"; - }); - binary-instances = pkgs.haskell.lib.dontCheck (pkgs.haskell.lib.overrideCabal super.binary-instances (old: { - libraryHaskellDepends = old.libraryHaskellDepends ++ [ - self.binary-orphans_1_0_1 - ]; - broken = false; - })); - binary-orphans_1_0_1 = pkgs.haskell.lib.dontCheck super.binary-orphans_1_0_1; - github = pkgs.haskell.lib.overrideCabal super.github (old: { - version = "0.22"; - sha256 = "15py79qcpj0k331i42njgwkirwyiacbc5razmxnm4672dvvip2qk"; - libraryHaskellDepends = old.libraryHaskellDepends ++ [ - self.binary-instances self.exceptions self.transformers-compat - ]; - }); - time-compat = pkgs.haskell.lib.dontCheck (pkgs.haskell.lib.overrideCabal super.time-compat (old: { - version = "1.9.2.2"; - sha256 = "05va0rqs759vbridbcl6hksp967j9anjvys8vx72fnfkhlrn2s52"; - libraryHaskellDepends = old.libraryHaskellDepends ++ [ - self.base-orphans - ]; - })); - }); - }); -} From e99858d26ed21472b2405a56e42c73693b319145 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Tue, 3 Dec 2019 11:48:37 +0200 Subject: [PATCH 008/121] Remove stackage badges from README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 877c51dc..45492903 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ Github [![Build Status](https://travis-ci.org/phadej/github.svg?branch=master)](https://travis-ci.org/phadej/github) [![Hackage](https://img.shields.io/hackage/v/github.svg)][hackage] -[![Stackage LTS 5](http://stackage.org/package/github/badge/lts-5)](http://stackage.org/lts-5/package/github) -[![Stackage Nightly](http://stackage.org/package/github/badge/nightly)](http://stackage.org/nightly/package/github) The Github API v3 for Haskell. @@ -34,6 +32,8 @@ Example Usage See the samples in the [samples/](https://github.com/fpco/github/tree/master/samples) directory. +Note: some samples might be outdated. + Documentation ============= From 75afbf8d7bfa4d82724064a9a10ef49da9ff29d1 Mon Sep 17 00:00:00 2001 From: Robbie McMichael <2044464+robbiemcmichael@users.noreply.github.com> Date: Sat, 14 Dec 2019 23:42:27 +1100 Subject: [PATCH 009/121] Add openssl flag to samples --- cabal.project | 1 + samples/Operational/Operational.hs | 14 +++++++++++++- samples/github-samples.cabal | 18 +++++++++++++++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/cabal.project b/cabal.project index 26dc579d..555119f5 100644 --- a/cabal.project +++ b/cabal.project @@ -8,3 +8,4 @@ constraints: hashable ^>=1.3 constraints: semigroups ^>=0.19 constraints: github +openssl +constraints: github-samples +openssl diff --git a/samples/Operational/Operational.hs b/samples/Operational/Operational.hs index ea8208e7..1117e72e 100644 --- a/samples/Operational/Operational.hs +++ b/samples/Operational/Operational.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE OverloadedStrings #-} @@ -9,11 +10,17 @@ import Prelude () import Control.Monad.Operational import Control.Monad.Trans.Except (ExceptT (..), runExceptT) import Network.HTTP.Client (Manager, newManager, ManagerSettings) + +#ifdef MIN_VERSION_http_client_tls +import Network.HTTP.Client.TLS (tlsManagerSettings) +#else import Network.HTTP.Client.OpenSSL (opensslManagerSettings, withOpenSSL) -import qualified GitHub as GH import qualified OpenSSL.Session as SSL import qualified OpenSSL.X509.SystemStore as SSL +#endif + +import qualified GitHub as GH data R a where R :: FromJSON a => GH.Request 'GH.RA a -> R a @@ -42,6 +49,10 @@ main = withOpenSSL $ do githubRequest $ GH.ownerInfoForR (GH.simpleOwnerLogin . GH.repoOwner $ repo) print owner +#ifdef MIN_VERSION_http_client_tls +withOpenSSL :: IO a -> IO a +withOpenSSL = id +#else tlsManagerSettings :: ManagerSettings tlsManagerSettings = opensslManagerSettings $ do ctx <- SSL.context @@ -52,3 +63,4 @@ tlsManagerSettings = opensslManagerSettings $ do SSL.contextLoadSystemCerts ctx SSL.contextSetVerificationMode ctx $ SSL.VerifyPeer True True Nothing return ctx +#endif diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index f0d4a4e7..2b4d2f69 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -17,6 +17,11 @@ tested-with: || ==8.6.5 || ==8.8.1 +flag openssl + description: "Use http-client-openssl" + manual: True + default: False + library hs-source-dirs: src ghc-options: -Wall @@ -38,15 +43,22 @@ executable github-operational , base-compat-batteries , github , github-samples - , HsOpenSSL - , HsOpenSSL-x509-system , http-client - , http-client-openssl , operational , text , transformers , transformers-compat + if flag(openssl) + build-depends: + HsOpenSSL + , HsOpenSSL-x509-system + , http-client-openssl + + else + build-depends: + http-client-tls + default-language: Haskell2010 common deps From 6b42b3031961920bdb719227893566dbd81f9ce5 Mon Sep 17 00:00:00 2001 From: Robbie McMichael <2044464+robbiemcmichael@users.noreply.github.com> Date: Sun, 15 Dec 2019 22:13:36 +1100 Subject: [PATCH 010/121] Manage orgs in GitHub Enterprise --- github.cabal | 2 + src/GitHub.hs | 9 +++ src/GitHub/Data.hs | 2 + src/GitHub/Data/Enterprise/Organizations.hs | 64 +++++++++++++++++++ .../Endpoints/Enterprise/Organizations.hs | 27 ++++++++ 5 files changed, 104 insertions(+) create mode 100644 src/GitHub/Data/Enterprise/Organizations.hs create mode 100644 src/GitHub/Endpoints/Enterprise/Organizations.hs diff --git a/github.cabal b/github.cabal index b3a18432..669bbb77 100644 --- a/github.cabal +++ b/github.cabal @@ -90,6 +90,7 @@ library GitHub.Data.DeployKeys GitHub.Data.Deployments GitHub.Data.Email + GitHub.Data.Enterprise.Organizations GitHub.Data.Events GitHub.Data.Gists GitHub.Data.GitData @@ -116,6 +117,7 @@ library GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring GitHub.Endpoints.Activity.Watching + GitHub.Endpoints.Enterprise.Organizations GitHub.Endpoints.Gists GitHub.Endpoints.Gists.Comments GitHub.Endpoints.GitData.Blobs diff --git a/src/GitHub.hs b/src/GitHub.hs index 2faf1618..d5845972 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -56,6 +56,14 @@ module GitHub ( watchersForR, reposWatchedByR, + -- * Enterprise + -- | See + + -- ** Organizations + -- | See + createOrganizationR, + renameOrganizationR, + -- * Gists -- | See -- @@ -401,6 +409,7 @@ import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring import GitHub.Endpoints.Activity.Watching +import GitHub.Endpoints.Enterprise.Organizations import GitHub.Endpoints.Gists import GitHub.Endpoints.Gists.Comments import GitHub.Endpoints.GitData.Blobs diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 6acc0bf2..bdedb894 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -41,6 +41,7 @@ module GitHub.Data ( module GitHub.Data.DeployKeys, module GitHub.Data.Deployments, module GitHub.Data.Email, + module GitHub.Data.Enterprise.Organizations, module GitHub.Data.Events, module GitHub.Data.Gists, module GitHub.Data.GitData, @@ -73,6 +74,7 @@ import GitHub.Data.Definitions import GitHub.Data.DeployKeys import GitHub.Data.Deployments import GitHub.Data.Email +import GitHub.Data.Enterprise.Organizations import GitHub.Data.Events import GitHub.Data.Gists import GitHub.Data.GitData diff --git a/src/GitHub/Data/Enterprise/Organizations.hs b/src/GitHub/Data/Enterprise/Organizations.hs new file mode 100644 index 00000000..967cd718 --- /dev/null +++ b/src/GitHub/Data/Enterprise/Organizations.hs @@ -0,0 +1,64 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +module GitHub.Data.Enterprise.Organizations where + +import GitHub.Data.Definitions +import GitHub.Data.Name (Name) +import GitHub.Data.URL (URL) +import GitHub.Internal.Prelude +import Prelude () + +data CreateOrganization = CreateOrganization + { createOrganizationLogin :: !(Name Organization) + , createOrganizationAdmin :: !(Name User) + , createOrganizationProfileName :: !(Maybe Text) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData CreateOrganization where rnf = genericRnf +instance Binary CreateOrganization + +data RenameOrganization = RenameOrganization + { renameOrganizationLogin :: !(Name Organization) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData RenameOrganization where rnf = genericRnf +instance Binary RenameOrganization + +data RenameOrganizationResponse = RenameOrganizationResponse + { renameOrganizationResponseMessage :: !Text + , renameOrganizationResponseUrl :: !URL + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData RenameOrganizationResponse where rnf = genericRnf +instance Binary RenameOrganizationResponse + +-- JSON Instances + +instance ToJSON CreateOrganization where + toJSON (CreateOrganization login admin profileName) = + object $ filter notNull + [ "login" .= login + , "admin" .= admin + , "profile_name" .= profileName + ] + where + notNull (_, Null) = False + notNull (_, _) = True + +instance ToJSON RenameOrganization where + toJSON (RenameOrganization login) = + object + [ "login" .= login + ] + +instance FromJSON RenameOrganizationResponse where + parseJSON = withObject "RenameOrganizationResponse" $ \o -> + RenameOrganizationResponse + <$> o .: "message" + <*> o .: "url" diff --git a/src/GitHub/Endpoints/Enterprise/Organizations.hs b/src/GitHub/Endpoints/Enterprise/Organizations.hs new file mode 100644 index 00000000..d94c7c72 --- /dev/null +++ b/src/GitHub/Endpoints/Enterprise/Organizations.hs @@ -0,0 +1,27 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +-- The GitHub Enterprise orgs API as described on . +module GitHub.Endpoints.Enterprise.Organizations ( + createOrganizationR, + renameOrganizationR, + module GitHub.Data, + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () + +-- | Create an organization. +-- See +createOrganizationR :: CreateOrganization -> Request 'RW SimpleOrganization +createOrganizationR = + command Post ["admin", "organizations"] . encode + +-- | Rename an organization. +-- See +renameOrganizationR :: Name Organization -> RenameOrganization -> Request 'RW RenameOrganizationResponse +renameOrganizationR org = + command Patch ["admin", "organizations", toPathPart org] . encode From b277deb25f76b88cd28d2c97b715041e05346d7f Mon Sep 17 00:00:00 2001 From: Robbie McMichael <2044464+robbiemcmichael@users.noreply.github.com> Date: Mon, 16 Dec 2019 19:24:18 +1100 Subject: [PATCH 011/121] Add samples for GitHub Enterprise org management --- samples/Enterprise/CreateOrganization.hs | 29 ++++++++++++++++++++++++ samples/Enterprise/RenameOrganization.hs | 28 +++++++++++++++++++++++ samples/github-samples.cabal | 10 ++++++++ 3 files changed, 67 insertions(+) create mode 100644 samples/Enterprise/CreateOrganization.hs create mode 100644 samples/Enterprise/RenameOrganization.hs diff --git a/samples/Enterprise/CreateOrganization.hs b/samples/Enterprise/CreateOrganization.hs new file mode 100644 index 00000000..897e7cd5 --- /dev/null +++ b/samples/Enterprise/CreateOrganization.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE OverloadedStrings #-} +module Main (main) where + +import Common + +import qualified GitHub + +main :: IO () +main = do + args <- getArgs + result <- case args of + [api_endpoint, token, org_login, org_admin, org_profile_name] -> + GitHub.github + (GitHub.EnterpriseOAuth + (fromString api_endpoint) + (fromString token) + ) + GitHub.createOrganizationR + (GitHub.CreateOrganization + (GitHub.mkOrganizationName $ fromString org_login) + (GitHub.mkUserName $ fromString org_admin) + (Just $ fromString org_profile_name) + ) + _ -> + error "usage: CreateOrganization " + case result of + Left err -> putStrLn $ "Error: " <> tshow err + Right org -> putStrLn $ tshow org diff --git a/samples/Enterprise/RenameOrganization.hs b/samples/Enterprise/RenameOrganization.hs new file mode 100644 index 00000000..bee86142 --- /dev/null +++ b/samples/Enterprise/RenameOrganization.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE OverloadedStrings #-} +module Main (main) where + +import Common + +import qualified GitHub + +main :: IO () +main = do + args <- getArgs + result <- case args of + [api_endpoint, token, current_name, new_name] -> + GitHub.github + (GitHub.EnterpriseOAuth + (fromString api_endpoint) + (fromString token) + ) + GitHub.renameOrganizationR + (GitHub.mkOrganizationName $ fromString current_name) + (GitHub.RenameOrganization + (GitHub.mkOrganizationName $ fromString new_name) + ) + _ -> + error "usage: RenameOrganization " + case result of + Left err -> putStrLn $ "Error: " <> tshow err + Right x -> putStrLn $ tshow x diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 2b4d2f69..b6a75728 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -98,6 +98,16 @@ executable github-create-deploy-key -- main-is: DeleteTeamMembershipFor.hs -- hs-source-dirs: Teams/Memberships +executable github-enterprise-create-organization + import: deps + main-is: CreateOrganization.hs + hs-source-dirs: Enterprise + +executable github-enterprise-rename-organization + import: deps + main-is: RenameOrganization.hs + hs-source-dirs: Enterprise + executable github-edit-team import: deps main-is: EditTeam.hs From 3fb5f0ce6c0359f37909d3315cee6c6ef9b38db8 Mon Sep 17 00:00:00 2001 From: Robbie McMichael <2044464+robbiemcmichael@users.noreply.github.com> Date: Mon, 16 Dec 2019 20:42:26 +1100 Subject: [PATCH 012/121] Add GitHub.Enterprise module --- github.cabal | 2 ++ samples/Enterprise/CreateOrganization.hs | 1 + samples/Enterprise/RenameOrganization.hs | 1 + src/GitHub.hs | 2 +- src/GitHub/Data.hs | 2 -- src/GitHub/Data/Enterprise.hs | 12 ++++++++++ .../Endpoints/Enterprise/Organizations.hs | 1 + src/GitHub/Enterprise.hs | 23 +++++++++++++++++++ 8 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 src/GitHub/Data/Enterprise.hs create mode 100644 src/GitHub/Enterprise.hs diff --git a/github.cabal b/github.cabal index 669bbb77..700d80cf 100644 --- a/github.cabal +++ b/github.cabal @@ -90,6 +90,7 @@ library GitHub.Data.DeployKeys GitHub.Data.Deployments GitHub.Data.Email + GitHub.Data.Enterprise GitHub.Data.Enterprise.Organizations GitHub.Data.Events GitHub.Data.Gists @@ -153,6 +154,7 @@ library GitHub.Endpoints.Users.Emails GitHub.Endpoints.Users.Followers GitHub.Endpoints.Users.PublicSSHKeys + GitHub.Enterprise GitHub.Internal.Prelude GitHub.Request diff --git a/samples/Enterprise/CreateOrganization.hs b/samples/Enterprise/CreateOrganization.hs index 897e7cd5..32fc97cc 100644 --- a/samples/Enterprise/CreateOrganization.hs +++ b/samples/Enterprise/CreateOrganization.hs @@ -5,6 +5,7 @@ module Main (main) where import Common import qualified GitHub +import qualified GitHub.Enterprise as GitHub main :: IO () main = do diff --git a/samples/Enterprise/RenameOrganization.hs b/samples/Enterprise/RenameOrganization.hs index bee86142..c16fdf56 100644 --- a/samples/Enterprise/RenameOrganization.hs +++ b/samples/Enterprise/RenameOrganization.hs @@ -5,6 +5,7 @@ module Main (main) where import Common import qualified GitHub +import qualified GitHub.Enterprise as GitHub main :: IO () main = do diff --git a/src/GitHub.hs b/src/GitHub.hs index d5845972..850258d1 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -3,7 +3,7 @@ -- License : BSD-3-Clause -- Maintainer : Oleg Grenrus -- --- This module re-exports all request constructrors and data definitions from +-- This module re-exports all request constructors and data definitions from -- this package. -- -- See "GitHub.Request" module for executing 'Request', in short diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index bdedb894..6acc0bf2 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -41,7 +41,6 @@ module GitHub.Data ( module GitHub.Data.DeployKeys, module GitHub.Data.Deployments, module GitHub.Data.Email, - module GitHub.Data.Enterprise.Organizations, module GitHub.Data.Events, module GitHub.Data.Gists, module GitHub.Data.GitData, @@ -74,7 +73,6 @@ import GitHub.Data.Definitions import GitHub.Data.DeployKeys import GitHub.Data.Deployments import GitHub.Data.Email -import GitHub.Data.Enterprise.Organizations import GitHub.Data.Events import GitHub.Data.Gists import GitHub.Data.GitData diff --git a/src/GitHub/Data/Enterprise.hs b/src/GitHub/Data/Enterprise.hs new file mode 100644 index 00000000..125a8d69 --- /dev/null +++ b/src/GitHub/Data/Enterprise.hs @@ -0,0 +1,12 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +-- This module re-exports the @GitHub.Data.Enterprise.@ submodules. +module GitHub.Data.Enterprise ( + -- * Module re-exports + module GitHub.Data.Enterprise.Organizations, + ) where + +import GitHub.Data.Enterprise.Organizations diff --git a/src/GitHub/Endpoints/Enterprise/Organizations.hs b/src/GitHub/Endpoints/Enterprise/Organizations.hs index d94c7c72..589c3d35 100644 --- a/src/GitHub/Endpoints/Enterprise/Organizations.hs +++ b/src/GitHub/Endpoints/Enterprise/Organizations.hs @@ -11,6 +11,7 @@ module GitHub.Endpoints.Enterprise.Organizations ( ) where import GitHub.Data +import GitHub.Data.Enterprise import GitHub.Internal.Prelude import Prelude () diff --git a/src/GitHub/Enterprise.hs b/src/GitHub/Enterprise.hs new file mode 100644 index 00000000..bb64b7d7 --- /dev/null +++ b/src/GitHub/Enterprise.hs @@ -0,0 +1,23 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +-- This module re-exports all request constructors and data definitions for +-- working with GitHub Enterprise. +-- +module GitHub.Enterprise ( + -- * Enterprise Admin + -- | See + + -- ** Organizations + -- | See + createOrganizationR, + renameOrganizationR, + + -- * Data definitions + module GitHub.Data.Enterprise, + ) where + +import GitHub.Data.Enterprise +import GitHub.Endpoints.Enterprise.Organizations From b7ee2b803157948479ceccd85233aa1e9474adc9 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Thu, 19 Dec 2019 15:55:38 +0200 Subject: [PATCH 013/121] Export withOpenSSL and tlsManagerSettings --- samples/Operational/Operational.hs | 31 +++--------------------------- samples/github-samples.cabal | 18 +---------------- src/GitHub/Request.hs | 5 +++++ 3 files changed, 9 insertions(+), 45 deletions(-) diff --git a/samples/Operational/Operational.hs b/samples/Operational/Operational.hs index 1117e72e..15833ece 100644 --- a/samples/Operational/Operational.hs +++ b/samples/Operational/Operational.hs @@ -9,16 +9,7 @@ import Prelude () import Control.Monad.Operational import Control.Monad.Trans.Except (ExceptT (..), runExceptT) -import Network.HTTP.Client (Manager, newManager, ManagerSettings) - -#ifdef MIN_VERSION_http_client_tls -import Network.HTTP.Client.TLS (tlsManagerSettings) -#else -import Network.HTTP.Client.OpenSSL (opensslManagerSettings, withOpenSSL) - -import qualified OpenSSL.Session as SSL -import qualified OpenSSL.X509.SystemStore as SSL -#endif +import Network.HTTP.Client (Manager, newManager) import qualified GitHub as GH @@ -38,8 +29,8 @@ githubRequest :: FromJSON a => GH.Request 'GH.RA a -> GithubMonad a githubRequest = singleton . R main :: IO () -main = withOpenSSL $ do - manager <- newManager tlsManagerSettings +main = GH.withOpenSSL $ do + manager <- newManager GH.tlsManagerSettings auth' <- getAuth case auth' of Nothing -> return () @@ -48,19 +39,3 @@ main = withOpenSSL $ do repo <- githubRequest $ GH.repositoryR "phadej" "github" githubRequest $ GH.ownerInfoForR (GH.simpleOwnerLogin . GH.repoOwner $ repo) print owner - -#ifdef MIN_VERSION_http_client_tls -withOpenSSL :: IO a -> IO a -withOpenSSL = id -#else -tlsManagerSettings :: ManagerSettings -tlsManagerSettings = opensslManagerSettings $ do - ctx <- SSL.context - SSL.contextAddOption ctx SSL.SSL_OP_NO_SSLv2 - SSL.contextAddOption ctx SSL.SSL_OP_NO_SSLv3 - SSL.contextAddOption ctx SSL.SSL_OP_NO_TLSv1 - SSL.contextSetCiphers ctx "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256" - SSL.contextLoadSystemCerts ctx - SSL.contextSetVerificationMode ctx $ SSL.VerifyPeer True True Nothing - return ctx -#endif diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 2b4d2f69..a26ffcfe 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -17,11 +17,6 @@ tested-with: || ==8.6.5 || ==8.8.1 -flag openssl - description: "Use http-client-openssl" - manual: True - default: False - library hs-source-dirs: src ghc-options: -Wall @@ -35,6 +30,7 @@ library default-language: Haskell2010 executable github-operational + default-language: Haskell2010 main-is: Operational.hs hs-source-dirs: Operational ghc-options: -Wall -threaded @@ -49,18 +45,6 @@ executable github-operational , transformers , transformers-compat - if flag(openssl) - build-depends: - HsOpenSSL - , HsOpenSSL-x509-system - , http-client-openssl - - else - build-depends: - http-client-tls - - default-language: Haskell2010 - common deps default-language: Haskell2010 ghc-options: -Wall diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index 83eba89b..fc0fd7dd 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -62,6 +62,11 @@ module GitHub.Request ( -- ** Preview PreviewAccept (..), PreviewParseResponse (..), + -- * SSL + -- | This always exist, independently of @openssl@ configuration flag. + -- They change accordingly, to make use of the library simpler. + withOpenSSL, + tlsManagerSettings, ) where import GitHub.Internal.Prelude From 2503b54595acee2683b81bf37d1f927f6e32b3c4 Mon Sep 17 00:00:00 2001 From: Sajid Ibne Anower Date: Fri, 20 Dec 2019 22:26:03 +1100 Subject: [PATCH 014/121] Label description (#418) * Add description field to IssueLabel * Add types for Update and New label * Use NewIssueLabel and UpdateIssueLabel for generating requests --- src/GitHub/Data/Definitions.hs | 55 +++++++++++++++++++++++++++ src/GitHub/Endpoints/Issues/Labels.hs | 19 +++------ 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/GitHub/Data/Definitions.hs b/src/GitHub/Data/Definitions.hs index f4503e66..8da8b761 100644 --- a/src/GitHub/Data/Definitions.hs +++ b/src/GitHub/Data/Definitions.hs @@ -268,6 +268,7 @@ data IssueLabel = IssueLabel { labelColor :: !Text , labelUrl :: !URL , labelName :: !(Name IssueLabel) + , labelDesc :: !(Maybe Text) } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -279,3 +280,57 @@ instance FromJSON IssueLabel where <$> o .: "color" <*> o .:? "url" .!= URL "" -- in events there aren't URL <*> o .: "name" + <*> o .:? "description" + + +------------------------------------------------------------------------------- +-- NewIssueLabel +------------------------------------------------------------------------------- + +data NewIssueLabel = NewIssueLabel + { newLabelColor :: !Text + , newLabelName :: !(Name NewIssueLabel) + , newLabelDesc :: !(Maybe Text) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData NewIssueLabel where rnf = genericRnf +instance Binary NewIssueLabel + + +instance ToJSON NewIssueLabel where + toJSON (NewIssueLabel color lblName lblDesc) = object $ filter notNull + [ "name" .= lblName + , "color" .= color + , "description" .= lblDesc + ] + where + notNull (_, Null) = False + notNull (_, _) = True + + + +------------------------------------------------------------------------------- +-- UpdateIssueLabel +------------------------------------------------------------------------------- + +data UpdateIssueLabel = UpdateIssueLabel + { updateLabelColor :: !Text + , updateLabelName :: !(Name UpdateIssueLabel) + , updateLabelDesc :: !(Maybe Text) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData UpdateIssueLabel where rnf = genericRnf +instance Binary UpdateIssueLabel + + +instance ToJSON UpdateIssueLabel where + toJSON (UpdateIssueLabel color lblName lblDesc) = object $ filter notNull + [ "new_name" .= lblName + , "color" .= color + , "description" .= lblDesc + ] + where + notNull (_, Null) = False + notNull (_, _) = True diff --git a/src/GitHub/Endpoints/Issues/Labels.hs b/src/GitHub/Endpoints/Issues/Labels.hs index cb80992e..3d129e8c 100644 --- a/src/GitHub/Endpoints/Issues/Labels.hs +++ b/src/GitHub/Endpoints/Issues/Labels.hs @@ -38,26 +38,19 @@ labelR user repo lbl = -- | Create a label. -- See -createLabelR :: Name Owner -> Name Repo -> Name IssueLabel -> String -> Request 'RW IssueLabel -createLabelR user repo lbl color = - command Post paths $ encode body - where - paths = ["repos", toPathPart user, toPathPart repo, "labels"] - body = object ["name" .= untagName lbl, "color" .= color] +createLabelR :: Name Owner -> Name Repo -> NewIssueLabel -> Request 'RW IssueLabel +createLabelR user repo = + command Post ["repos", toPathPart user, toPathPart repo, "labels"] . encode -- | Update a label. -- See updateLabelR :: Name Owner -> Name Repo -> Name IssueLabel -- ^ old label name - -> Name IssueLabel -- ^ new label name - -> String -- ^ new color + -> UpdateIssueLabel -- ^ new label -> Request 'RW IssueLabel -updateLabelR user repo oldLbl newLbl color = - command Patch paths (encode body) - where - paths = ["repos", toPathPart user, toPathPart repo, "labels", toPathPart oldLbl] - body = object ["name" .= untagName newLbl, "color" .= color] +updateLabelR user repo oldLbl = + command Patch ["repos", toPathPart user, toPathPart repo, "labels", toPathPart oldLbl] . encode -- | Delete a label. -- See From bbe378bbe2fad28ff4069537bc2b46fa4b8e89c9 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Fri, 20 Dec 2019 15:17:59 +0200 Subject: [PATCH 015/121] Add executeRequestWithMgrAndRes --- CHANGELOG.md | 6 +++ github.cabal | 2 +- samples/Operational/Operational.hs | 34 +++++++++----- src/GitHub/Auth.hs | 6 +++ src/GitHub/Data/Deployments.hs | 1 - src/GitHub/Data/RateLimit.hs | 31 +++++++++++-- src/GitHub/Internal/Prelude.hs | 2 +- src/GitHub/Request.hs | 74 +++++++++++++++--------------- 8 files changed, 102 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc67227..8d776cb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ This reduces symbol bloat in the library. [#409](https://github.com/phadej/github/pull/409) - Update `Repo`, `NewRepo` and `EditRepo` data types [#407](https://github.com/phadej/github/pull/407) +- Add `executeRequestWithMgrAndRes` + [#421](https://github.com/phadej/github/pull/421) +- Add `limitsFromHttpResponse` + [#421](https://github.com/phadej/github/pull/421) +- Add label descriptions + [#418](https://github.com/phadej/github/pull/418) ## Changes for 0.23 diff --git a/github.cabal b/github.cabal index b3a18432..0e9a7335 100644 --- a/github.cabal +++ b/github.cabal @@ -165,7 +165,7 @@ library , deepseq >=1.3.0.2 && <1.5 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.3 , text >=1.2.0.6 && <1.3 - , time >=1.4 && <1.10 + , time-compat >=1.9.2.2 && <1.10 , transformers >=0.3.0.0 && <0.6 -- other packages diff --git a/samples/Operational/Operational.hs b/samples/Operational/Operational.hs index 15833ece..4e669ff4 100644 --- a/samples/Operational/Operational.hs +++ b/samples/Operational/Operational.hs @@ -7,23 +7,26 @@ module Main (main) where import Common import Prelude () -import Control.Monad.Operational -import Control.Monad.Trans.Except (ExceptT (..), runExceptT) -import Network.HTTP.Client (Manager, newManager) +import Control.Exception (throw) +import Control.Monad.IO.Class (liftIO) +import Control.Monad.Operational (Program, ProgramViewT (..), singleton, view) +import Control.Monad.Trans.Except (ExceptT (..), runExceptT) +import Network.HTTP.Client (Manager, newManager, responseBody) -import qualified GitHub as GH +import qualified GitHub as GH data R a where R :: FromJSON a => GH.Request 'GH.RA a -> R a type GithubMonad a = Program R a -runMonad :: Manager -> GH.Auth -> GithubMonad a -> ExceptT GH.Error IO a +runMonad :: GH.AuthMethod auth => Manager -> auth -> GithubMonad a -> ExceptT GH.Error IO a runMonad mgr auth m = case view m of Return a -> return a R req :>>= k -> do - b <- ExceptT $ GH.executeRequestWithMgr mgr auth req - runMonad mgr auth (k b) + res <- ExceptT $ GH.executeRequestWithMgrAndRes mgr auth req + liftIO $ print $ GH.limitsFromHttpResponse res + runMonad mgr auth (k (responseBody res)) githubRequest :: FromJSON a => GH.Request 'GH.RA a -> GithubMonad a githubRequest = singleton . R @@ -33,9 +36,18 @@ main = GH.withOpenSSL $ do manager <- newManager GH.tlsManagerSettings auth' <- getAuth case auth' of - Nothing -> return () + Nothing -> do + (owner, rl) <- runExceptT (runMonad manager () script) >>= either throw return + print owner + print rl Just auth -> do - owner <- runExceptT $ runMonad manager auth $ do - repo <- githubRequest $ GH.repositoryR "phadej" "github" - githubRequest $ GH.ownerInfoForR (GH.simpleOwnerLogin . GH.repoOwner $ repo) + (owner, rl) <- runExceptT (runMonad manager auth script) >>= either throw return print owner + print rl + +script :: Program R (GH.Owner, GH.Limits) +script = do + repo <- githubRequest $ GH.repositoryR "phadej" "github" + owner <- githubRequest $ GH.ownerInfoForR (GH.simpleOwnerLogin . GH.repoOwner $ repo) + rl <- githubRequest GH.rateLimitR + return (owner, GH.rateLimitCore rl) diff --git a/src/GitHub/Auth.hs b/src/GitHub/Auth.hs index 7918c0af..432b2486 100644 --- a/src/GitHub/Auth.hs +++ b/src/GitHub/Auth.hs @@ -30,12 +30,18 @@ instance Binary Auth instance Hashable Auth -- | A type class for different authentication methods +-- +-- Note the '()' intance, which doee nothing, i.e. is unauthenticated. class AuthMethod a where -- | Custom API endpoint without trailing slash endpoint :: a -> Maybe Text -- | A function which sets authorisation on an HTTP request setAuthRequest :: a -> HTTP.Request -> HTTP.Request +instance AuthMethod () where + endpoint _ = Nothing + setAuthRequest _ = id + instance AuthMethod Auth where endpoint (BasicAuth _ _) = Nothing endpoint (OAuth _) = Nothing diff --git a/src/GitHub/Data/Deployments.hs b/src/GitHub/Data/Deployments.hs index 9e65485d..face7a52 100644 --- a/src/GitHub/Data/Deployments.hs +++ b/src/GitHub/Data/Deployments.hs @@ -21,7 +21,6 @@ import Control.Arrow (second) import Data.ByteString (ByteString) import Data.Maybe (catMaybes) import Data.Text (Text) -import Data.Time.Clock (UTCTime) import Data.Vector (Vector) import GitHub.Data.Definitions (SimpleUser) diff --git a/src/GitHub/Data/RateLimit.hs b/src/GitHub/Data/RateLimit.hs index 3fbd6211..2ba008f0 100644 --- a/src/GitHub/Data/RateLimit.hs +++ b/src/GitHub/Data/RateLimit.hs @@ -8,12 +8,17 @@ module GitHub.Data.RateLimit where import GitHub.Internal.Prelude import Prelude () +import Data.Time.Clock.System.Compat (SystemTime (..)) + +import qualified Data.ByteString.Char8 as BS8 +import qualified Network.HTTP.Client as HTTP + data Limits = Limits { limitsMax :: !Int , limitsRemaining :: !Int - , limitsReset :: !Int -- TODO: change to proper type + , limitsReset :: !SystemTime } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, {- Data, -} Typeable, Eq, Ord, Generic) instance NFData Limits where rnf = genericRnf instance Binary Limits @@ -22,14 +27,14 @@ instance FromJSON Limits where parseJSON = withObject "Limits" $ \obj -> Limits <$> obj .: "limit" <*> obj .: "remaining" - <*> obj .: "reset" + <*> fmap (\t -> MkSystemTime t 0) (obj .: "reset") data RateLimit = RateLimit { rateLimitCore :: Limits , rateLimitSearch :: Limits , rateLimitGraphQL :: Limits } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, {- Data, -} Typeable, Eq, Ord, Generic) instance NFData RateLimit where rnf = genericRnf instance Binary RateLimit @@ -41,3 +46,21 @@ instance FromJSON RateLimit where <$> resources .: "core" <*> resources .: "search" <*> resources .: "graphql" + +------------------------------------------------------------------------------- +-- Extras +------------------------------------------------------------------------------- + +-- | @since 0.24 +limitsFromHttpResponse :: HTTP.Response a -> Maybe Limits +limitsFromHttpResponse res = do + let hdrs = HTTP.responseHeaders res + m <- lookup "X-RateLimit-Limit" hdrs >>= readIntegral + r <- lookup "X-RateLimit-Remaining" hdrs >>= readIntegral + t <- lookup "X-RateLimit-Reset" hdrs >>= readIntegral + return (Limits m r (MkSystemTime t 0)) + where + readIntegral :: Num a => BS8.ByteString -> Maybe a + readIntegral bs = case BS8.readInt bs of + Just (n, bs') | BS8.null bs' -> Just (fromIntegral n) + _ -> Nothing diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index 07a748b3..8c4785c3 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -53,7 +53,7 @@ import Data.Maybe (catMaybes) import Data.Semigroup (Semigroup (..)) import Data.String (IsString (..)) import Data.Text (Text, pack, unpack) -import Data.Time (UTCTime) +import Data.Time.Compat (UTCTime) import Data.Time.ISO8601 (formatISO8601) import Data.Vector (Vector) import Data.Vector.Instances () diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index fc0fd7dd..b72d25be 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -46,6 +46,7 @@ module GitHub.Request ( -- * Request execution in IO executeRequest, executeRequestWithMgr, + executeRequestWithMgrAndRes, executeRequest', executeRequestWithMgr', executeRequestMaybe, @@ -66,7 +67,7 @@ module GitHub.Request ( -- | This always exist, independently of @openssl@ configuration flag. -- They change accordingly, to make use of the library simpler. withOpenSSL, - tlsManagerSettings, + tlsManagerSettings, ) where import GitHub.Internal.Prelude @@ -112,7 +113,7 @@ import qualified OpenSSL.Session as SSL import qualified OpenSSL.X509.SystemStore as SSL #endif -import GitHub.Auth (Auth, AuthMethod, endpoint, setAuthRequest) +import GitHub.Auth (AuthMethod, endpoint, setAuthRequest) import GitHub.Data (Error (..)) import GitHub.Data.PullRequests (MergeResult (..)) import GitHub.Data.Request @@ -206,6 +207,7 @@ lessFetchCount :: Int -> FetchCount -> Bool lessFetchCount _ FetchAll = True lessFetchCount i (FetchAtLeast j) = i < fromIntegral j + -- | Like 'executeRequest' but with provided 'Manager'. executeRequestWithMgr :: (AuthMethod am, ParseResponse mt a) @@ -213,26 +215,38 @@ executeRequestWithMgr -> am -> GenRequest mt rw a -> IO (Either Error a) -executeRequestWithMgr mgr auth req = runExceptT $ do +executeRequestWithMgr mgr auth req = + fmap (fmap responseBody) (executeRequestWithMgrAndRes mgr auth req) + +-- | Execute request and return the last received 'HTTP.Response'. +-- +-- @since 0.24 +executeRequestWithMgrAndRes + :: (AuthMethod am, ParseResponse mt a) + => Manager + -> am + -> GenRequest mt rw a + -> IO (Either Error (HTTP.Response a)) +executeRequestWithMgrAndRes mgr auth req = runExceptT $ do httpReq <- makeHttpRequest (Just auth) req performHttpReq httpReq req where - httpLbs' :: HTTP.Request -> ExceptT Error IO (Response LBS.ByteString) + httpLbs' :: HTTP.Request -> ExceptT Error IO (HTTP.Response LBS.ByteString) httpLbs' req' = lift (httpLbs req' mgr) `catch` onHttpException - performHttpReq :: forall rw mt b. ParseResponse mt b => HTTP.Request -> GenRequest mt rw b -> ExceptT Error IO b + performHttpReq :: forall rw mt b. ParseResponse mt b => HTTP.Request -> GenRequest mt rw b -> ExceptT Error IO (HTTP.Response b) performHttpReq httpReq Query {} = do res <- httpLbs' httpReq - unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) + (<$ res) <$> unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) performHttpReq httpReq (PagedQuery _ _ l) = - unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO b)) + unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) where predicate v = lessFetchCount (V.length v) l performHttpReq httpReq (Command _ _ _) = do res <- httpLbs' httpReq - unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) + (<$ res) <$> unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) -- | Like 'executeRequest' but without authentication. executeRequest' :: ParseResponse mt a => GenRequest mt 'RO a -> IO (Either Error a) @@ -246,21 +260,7 @@ executeRequestWithMgr' => Manager -> GenRequest mt 'RO a -> IO (Either Error a) -executeRequestWithMgr' mgr req = runExceptT $ do - httpReq <- makeHttpRequest (Nothing :: Maybe Auth) req - performHttpReq httpReq req - where - httpLbs' :: HTTP.Request -> ExceptT Error IO (Response LBS.ByteString) - httpLbs' req' = lift (httpLbs req' mgr) `catch` onHttpException - - performHttpReq :: forall mt b. ParseResponse mt b => HTTP.Request -> GenRequest mt 'RO b -> ExceptT Error IO b - performHttpReq httpReq Query {} = do - res <- httpLbs' httpReq - unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) - performHttpReq httpReq (PagedQuery _ _ l) = - unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO b)) - where - predicate v = lessFetchCount (V.length v) l +executeRequestWithMgr' mgr = executeRequestWithMgr mgr () -- | Helper for picking between 'executeRequest' and 'executeRequest''. -- @@ -302,9 +302,9 @@ class Accept mt => ParseResponse (mt :: MediaType *) a where -- | Parse API response. -- -- @ --- parseResponse :: 'FromJSON' a => 'Response' 'LBS.ByteString' -> 'Either' 'Error' a +-- parseResponse :: 'FromJSON' a => 'HTTP.Response' 'LBS.ByteString' -> 'Either' 'Error' a -- @ -parseResponseJSON :: (FromJSON a, MonadError Error m) => Response LBS.ByteString -> m a +parseResponseJSON :: (FromJSON a, MonadError Error m) => HTTP.Response LBS.ByteString -> m a parseResponseJSON res = case eitherDecode (responseBody res) of Right x -> return x Left err -> throwError . ParseError . T.pack $ err @@ -349,9 +349,9 @@ instance b ~ URI => ParseResponse 'MtRedirect b where -- | Helper for handling of 'RequestRedirect'. -- -- @ --- parseRedirect :: 'Response' 'LBS.ByteString' -> 'Either' 'Error' a +-- parseRedirect :: 'HTTP.Response' 'LBS.ByteString' -> 'Either' 'Error' a -- @ -parseRedirect :: MonadError Error m => URI -> Response LBS.ByteString -> m URI +parseRedirect :: MonadError Error m => URI -> HTTP.Response LBS.ByteString -> m URI parseRedirect originalUri rsp = do let status = responseStatus rsp when (statusCode status /= 302) $ @@ -501,7 +501,7 @@ makeHttpRequest auth r = case r of setBody body req = req { requestBody = RequestBodyLBS body } -- | Query @Link@ header with @rel=next@ from the request headers. -getNextUrl :: Response a -> Maybe URI +getNextUrl :: HTTP.Response a -> Maybe URI getNextUrl req = do linkHeader <- lookup "Link" (responseHeaders req) links <- parseLinkHeaderBS linkHeader @@ -516,25 +516,27 @@ getNextUrl req = do -- | Helper for making paginated requests. Responses, @a@ are combined monoidally. -- +-- The result is wrapped in the last received 'HTTP.Response'. +-- -- @ -- performPagedRequest :: ('FromJSON' a, 'Semigroup' a) --- => ('HTTP.Request' -> 'ExceptT' 'Error' 'IO' ('Response' 'LBS.ByteString')) +-- => ('HTTP.Request' -> 'ExceptT' 'Error' 'IO' ('HTTP.Response' 'LBS.ByteString')) -- -> (a -> 'Bool') -- -> 'HTTP.Request' --- -> 'ExceptT' 'Error' 'IO' a +-- -> 'ExceptT' 'Error' 'IO' ('HTTP.Response' a) -- @ performPagedRequest :: forall a m mt. (ParseResponse mt a, Semigroup a, MonadCatch m, MonadError Error m) - => (HTTP.Request -> m (Response LBS.ByteString)) -- ^ `httpLbs` analogue - -> (a -> Bool) -- ^ predicate to continue iteration - -> HTTP.Request -- ^ initial request - -> Tagged mt (m a) + => (HTTP.Request -> m (HTTP.Response LBS.ByteString)) -- ^ `httpLbs` analogue + -> (a -> Bool) -- ^ predicate to continue iteration + -> HTTP.Request -- ^ initial request + -> Tagged mt (m (HTTP.Response a)) performPagedRequest httpLbs' predicate initReq = Tagged $ do res <- httpLbs' initReq m <- unTagged (parseResponse initReq res :: Tagged mt (m a)) go m res initReq where - go :: a -> Response LBS.ByteString -> HTTP.Request -> m a + go :: a -> HTTP.Response LBS.ByteString -> HTTP.Request -> m (HTTP.Response a) go acc res req = case (predicate acc, getNextUrl res) of (True, Just uri) -> do @@ -542,7 +544,7 @@ performPagedRequest httpLbs' predicate initReq = Tagged $ do res' <- httpLbs' req' m <- unTagged (parseResponse req' res' :: Tagged mt (m a)) go (acc <> m) res' req' - (_, _) -> return acc + (_, _) -> return (acc <$ res) ------------------------------------------------------------------------------- -- Internal From e4ddc1ab3a0e8c7830ca1d682faf4c8eff71fbcf Mon Sep 17 00:00:00 2001 From: "Thomas M. DuBuisson" Date: Fri, 3 Jan 2020 15:59:36 -0800 Subject: [PATCH 016/121] Add support for the comment reply endpoint --- src/GitHub/Data/Comments.hs | 12 ++++++++++++ src/GitHub/Endpoints/PullRequests/Comments.hs | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/GitHub/Data/Comments.hs b/src/GitHub/Data/Comments.hs index 91c6d4e5..cb52b04b 100644 --- a/src/GitHub/Data/Comments.hs +++ b/src/GitHub/Data/Comments.hs @@ -83,3 +83,15 @@ instance ToJSON NewPullComment where , "path" .= path , "position" .= pos ] + +data PullCommentReply = PullCommentReply + { pullCommentReplyBody :: Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData PullCommentReply where rnf = genericRnf + +instance ToJSON PullCommentReply where + toJSON (PullCommentReply b) = + object [ "body" .= b + ] diff --git a/src/GitHub/Endpoints/PullRequests/Comments.hs b/src/GitHub/Endpoints/PullRequests/Comments.hs index 889de642..9bb6fca2 100644 --- a/src/GitHub/Endpoints/PullRequests/Comments.hs +++ b/src/GitHub/Endpoints/PullRequests/Comments.hs @@ -9,6 +9,7 @@ module GitHub.Endpoints.PullRequests.Comments ( pullRequestCommentsR, pullRequestCommentR, createPullCommentR, + createPullCommentReplyR, module GitHub.Data, ) where @@ -36,3 +37,13 @@ createPullCommentR user repo iss commit path position body = command Post parts (encode $ NewPullComment commit path position body) where parts = ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart iss, "comments"] + +-- | Create a comment reply. +-- +-- See +createPullCommentReplyR :: Name Owner -> Name Repo -> IssueNumber -> Id Comment -> Text -> Request 'RW Comment +createPullCommentReplyR user repo iss cid body = + command Post parts (encode $ PullCommentReply body) + where + parts = ["repos", toPathPart user, toPathPart repo, "pulls", toPathPart iss + , "comments", toPathPart cid, "replies"] From e712718ff99c1846391ebed9c38ebfb70f7844fa Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Thu, 9 Jan 2020 13:32:03 +0100 Subject: [PATCH 017/121] Add support for collaborator permission endpoint This endpoint allows checking whether a collaborator has read, write, or admin permissions. We are using this endpoint in [1], from this branch, and so far it has been working fine. [1]: https://github.com/channable/hoff --- src/GitHub.hs | 1 + src/GitHub/Data/Repos.hs | 41 +++++++++++++++++++++ src/GitHub/Endpoints/Repos/Collaborators.hs | 11 ++++++ 3 files changed, 53 insertions(+) diff --git a/src/GitHub.hs b/src/GitHub.hs index 2faf1618..0c0abc3d 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -258,6 +258,7 @@ module GitHub ( -- ** Collaborators -- | See collaboratorsOnR, + collaboratorPermissionOnR, isCollaboratorOnR, addCollaboratorR, diff --git a/src/GitHub/Data/Repos.hs b/src/GitHub/Data/Repos.hs index 8486fb6a..d9c9cf1b 100644 --- a/src/GitHub/Data/Repos.hs +++ b/src/GitHub/Data/Repos.hs @@ -20,6 +20,7 @@ import GitHub.Internal.Prelude import Prelude () import qualified Data.HashMap.Strict as HM +import qualified Data.Text as T #if MIN_VERSION_aeson(1,0,0) import Data.Aeson.Types (FromJSONKey (..), fromJSONKeyCoerce) #else @@ -158,6 +159,27 @@ contributorToSimpleUser (AnonymousContributor _ _) = Nothing contributorToSimpleUser (KnownContributor _contributions avatarUrl name url uid _gravatarid) = Just $ SimpleUser uid name avatarUrl url +-- | The permission of a collaborator on a repository. +-- See +data CollaboratorPermission + = CollaboratorPermissionAdmin + | CollaboratorPermissionWrite + | CollaboratorPermissionRead + | CollaboratorPermissionNone + deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) + +instance NFData CollaboratorPermission where rnf = genericRnf +instance Binary CollaboratorPermission + +-- | A collaborator and its permission on a repository. +-- See +data CollaboratorWithPermission + = CollaboratorWithPermission SimpleUser CollaboratorPermission + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData CollaboratorWithPermission where rnf = genericRnf +instance Binary CollaboratorWithPermission + -- JSON instances instance FromJSON Repo where @@ -303,3 +325,22 @@ instance IsPathPart ArchiveFormat where toPathPart af = case af of ArchiveFormatTarball -> "tarball" ArchiveFormatZipball -> "zipball" + +instance FromJSON CollaboratorPermission where + parseJSON = withText "CollaboratorPermission" $ \t -> case T.toLower t of + "admin" -> pure CollaboratorPermissionAdmin + "write" -> pure CollaboratorPermissionWrite + "read" -> pure CollaboratorPermissionRead + "none" -> pure CollaboratorPermissionNone + _ -> fail $ "Unknown CollaboratorPermission: " <> T.unpack t + +instance ToJSON CollaboratorPermission where + toJSON CollaboratorPermissionAdmin = "admin" + toJSON CollaboratorPermissionWrite = "write" + toJSON CollaboratorPermissionRead = "read" + toJSON CollaboratorPermissionNone = "none" + +instance FromJSON CollaboratorWithPermission where + parseJSON = withObject "CollaboratorWithPermission" $ \o -> CollaboratorWithPermission + <$> o .: "user" + <*> o .: "permission" diff --git a/src/GitHub/Endpoints/Repos/Collaborators.hs b/src/GitHub/Endpoints/Repos/Collaborators.hs index bc5680c6..5322b36d 100644 --- a/src/GitHub/Endpoints/Repos/Collaborators.hs +++ b/src/GitHub/Endpoints/Repos/Collaborators.hs @@ -7,6 +7,7 @@ -- . module GitHub.Endpoints.Repos.Collaborators ( collaboratorsOnR, + collaboratorPermissionOnR, isCollaboratorOnR, addCollaboratorR, module GitHub.Data, @@ -22,6 +23,16 @@ collaboratorsOnR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector S collaboratorsOnR user repo = pagedQuery ["repos", toPathPart user, toPathPart repo, "collaborators"] [] +-- | Review a user's permission level. +-- +collaboratorPermissionOnR + :: Name Owner -- ^ Repository owner + -> Name Repo -- ^ Repository name + -> Name User -- ^ Collaborator to check permissions of. + -> GenRequest 'MtJSON rw CollaboratorWithPermission +collaboratorPermissionOnR owner repo coll = + query ["repos", toPathPart owner, toPathPart repo, "collaborators", toPathPart coll, "permission"] [] + -- | Check if a user is a collaborator. -- See isCollaboratorOnR From 3cb9b2343fc7a23009aaa897e7944cee73e5f116 Mon Sep 17 00:00:00 2001 From: vrom911 Date: Mon, 10 Feb 2020 19:00:39 +0000 Subject: [PATCH 018/121] Use IssueNumber in editIssueR and issueR --- spec/GitHub/IssuesSpec.hs | 5 +++++ src/GitHub/Endpoints/Issues.hs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/GitHub/IssuesSpec.hs b/spec/GitHub/IssuesSpec.hs index cfad56e3..2ed08278 100644 --- a/spec/GitHub/IssuesSpec.hs +++ b/spec/GitHub/IssuesSpec.hs @@ -38,6 +38,11 @@ spec = do cms <- GitHub.executeRequest auth $ GitHub.commentsR owner repo (GitHub.issueNumber i) 1 cms `shouldSatisfy` isRight + describe "issueR" $ do + it "fetches issue #428" $ withAuth $ \auth -> do + resIss <- GitHub.executeRequest auth $ + GitHub.issueR "phadej" "github" (GitHub.IssueNumber 428) + resIss `shouldSatisfy` isRight where repos = [ ("thoughtbot", "paperclip") diff --git a/src/GitHub/Endpoints/Issues.hs b/src/GitHub/Endpoints/Issues.hs index d2b24e69..f1980dbf 100644 --- a/src/GitHub/Endpoints/Issues.hs +++ b/src/GitHub/Endpoints/Issues.hs @@ -33,7 +33,7 @@ organizationIssuesR org opts = -- | Query a single issue. -- See -issueR :: Name Owner -> Name Repo -> Id Issue -> Request k Issue +issueR :: Name Owner -> Name Repo -> IssueNumber -> Request k Issue issueR user reqRepoName reqIssueNumber = query ["repos", toPathPart user, toPathPart reqRepoName, "issues", toPathPart reqIssueNumber] [] @@ -63,6 +63,6 @@ editOfIssue = EditIssue Nothing Nothing Nothing Nothing Nothing Nothing -- | Edit an issue. -- See -editIssueR :: Name Owner -> Name Repo -> Id Issue -> EditIssue -> Request 'RW Issue +editIssueR :: Name Owner -> Name Repo -> IssueNumber -> EditIssue -> Request 'RW Issue editIssueR user repo iss = command Patch ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iss] . encode From 7d9fcbaed66dd2ac742d4d8c06ec20de0a0bf312 Mon Sep 17 00:00:00 2001 From: Robbie McMichael <2044464+robbiemcmichael@users.noreply.github.com> Date: Tue, 11 Feb 2020 23:48:53 +1100 Subject: [PATCH 019/121] Housekeeping for data and endpoint exports - Add missing data and endpoint exports - Move statuses exports under repositories - Remove duplicated enterprise exports --- src/GitHub.hs | 38 ++++++++++++++++++++++++-------------- src/GitHub/Data.hs | 4 +++- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/GitHub.hs b/src/GitHub.hs index e2220376..087a72d1 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -56,14 +56,6 @@ module GitHub ( watchersForR, reposWatchedByR, - -- * Enterprise - -- | See - - -- ** Organizations - -- | See - createOrganizationR, - renameOrganizationR, - -- * Gists -- | See -- @@ -289,6 +281,15 @@ module GitHub ( commitR, diffR, + -- ** Contents + -- | See + contentsForR, + readmeForR, + archiveForR, + createFileR, + updateFileR, + deleteFileR, + -- ** Deploy Keys -- | See deployKeysForR, @@ -316,6 +317,12 @@ module GitHub ( -- * Create a fork forksForR, + -- ** Statuses + -- | See + createStatusR, + statusesForR, + statusForR, + -- ** Webhooks -- | See webhooksForR, @@ -389,11 +396,13 @@ module GitHub ( usersFollowingR, usersFollowedByR, - -- ** Statuses - -- | See - createStatusR, - statusesForR, - statusForR, + -- ** Git SSH Keys + -- | See + publicSSHKeysR, + publicSSHKeysForR, + publicSSHKeyR, + createUserPublicSSHKeyR, + deleteUserPublicSSHKeyR, -- ** Rate Limit -- | See @@ -410,7 +419,6 @@ import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring import GitHub.Endpoints.Activity.Watching -import GitHub.Endpoints.Enterprise.Organizations import GitHub.Endpoints.Gists import GitHub.Endpoints.Gists.Comments import GitHub.Endpoints.GitData.Blobs @@ -433,6 +441,7 @@ import GitHub.Endpoints.Repos import GitHub.Endpoints.Repos.Collaborators import GitHub.Endpoints.Repos.Comments import GitHub.Endpoints.Repos.Commits +import GitHub.Endpoints.Repos.Contents import GitHub.Endpoints.Repos.DeployKeys import GitHub.Endpoints.Repos.Deployments import GitHub.Endpoints.Repos.Forks @@ -444,4 +453,5 @@ import GitHub.Endpoints.Search import GitHub.Endpoints.Users import GitHub.Endpoints.Users.Emails import GitHub.Endpoints.Users.Followers +import GitHub.Endpoints.Users.PublicSSHKeys import GitHub.Request diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 6acc0bf2..6b475d40 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -59,7 +59,8 @@ module GitHub.Data ( module GitHub.Data.Statuses, module GitHub.Data.Teams, module GitHub.Data.URL, - module GitHub.Data.Webhooks + module GitHub.Data.Webhooks, + module GitHub.Data.Webhooks.Validate, ) where import GitHub.Internal.Prelude @@ -94,6 +95,7 @@ import GitHub.Data.Statuses import GitHub.Data.Teams import GitHub.Data.URL import GitHub.Data.Webhooks +import GitHub.Data.Webhooks.Validate mkOwnerId :: Int -> Id Owner mkOwnerId = Id From b9d2d1ba2326d417d1dcbbc4ce225835af76a108 Mon Sep 17 00:00:00 2001 From: Ali Abrar Date: Fri, 14 Feb 2020 10:37:53 -0500 Subject: [PATCH 020/121] Add draft option to mergeable state --- src/GitHub/Data/Options.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 9ef2be6a..70665317 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -98,6 +98,7 @@ data MergeableState | StateUnstable | StateBlocked | StateBehind + | StateDraft deriving (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) @@ -108,6 +109,7 @@ instance ToJSON MergeableState where toJSON StateUnstable = String "unstable" toJSON StateBlocked = String "blocked" toJSON StateBehind = String "behind" + toJSON StateDraft = String "draft" instance FromJSON MergeableState where parseJSON = withText "MergeableState" $ \t -> case T.toLower t of @@ -117,6 +119,7 @@ instance FromJSON MergeableState where "unstable" -> pure StateUnstable "blocked" -> pure StateBlocked "behind" -> pure StateBehind + "draft" -> pure StateDraft _ -> fail $ "Unknown MergeableState: " <> T.unpack t instance NFData MergeableState where rnf = genericRnf From dce8c7fe404083b1ddad5c665f0e7e7cb4dddf8b Mon Sep 17 00:00:00 2001 From: Victor Nawothnig Date: Sat, 15 Feb 2020 02:10:00 +0100 Subject: [PATCH 021/121] Add missing tick --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45492903..cc825f98 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ import qualified GitHub main :: IO () main = do - possibleUsers <- github GitHub.usersFollowingR "phadej" + possibleUsers <- github' GitHub.usersFollowingR "phadej" T.putStrLn $ either (("Error: " <>) . pack . show) (foldMap ((<> "\n") . formatUser)) possibleUsers From e6163c44ab932671219b5595fd9bac5afc8b5745 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Tue, 18 Feb 2020 21:37:36 +0200 Subject: [PATCH 022/121] Add recent PRs to Changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d776cb8..52400168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,18 @@ This reduces symbol bloat in the library. [#421](https://github.com/phadej/github/pull/421) - Add label descriptions [#418](https://github.com/phadej/github/pull/418) +- Add "draft" option to mergeable state + [#431](https://github.com/phadej/github/pull/431) +- Use IssueNumber in editIssueR and issueR + [#429](https://github.com/phadej/github/pull/429) +- Manage orgs in GitHub Enterprise + [#420](https://github.com/phadej/github/pull/420) +- Add support for collaborator permission endpoint + [#425](https://github.com/phadej/github/pull/425) +- Add support for the comment reply endpoint + [#424](Add support for the comment reply endpoint) +- Organise exports in `GitHub` + [#430](https://github.com/phadej/github/pull/430) ## Changes for 0.23 From 807d74c5ecb5f9c30a75dd15af526a6103bff9cc Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Tue, 18 Feb 2020 21:44:14 +0200 Subject: [PATCH 023/121] Export createPullCommentReplyR, --- src/GitHub.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GitHub.hs b/src/GitHub.hs index 087a72d1..62c1ea6d 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -223,6 +223,7 @@ module GitHub ( pullRequestCommentsR, pullRequestCommentR, createPullCommentR, + createPullCommentReplyR, -- ** Pull request reviews -- | See From b924756659ccb930a070c6c5fa05c070611c86d2 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves <2335822+alexfmpe@users.noreply.github.com> Date: Tue, 21 Apr 2020 20:45:43 +0100 Subject: [PATCH 024/121] Fix typo --- src/GitHub/Request.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index b72d25be..f0724d2c 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -31,7 +31,7 @@ -- > githubRequest :: GH.Request 'False a -> GithubMonad a -- > githubRequest = singleton module GitHub.Request ( - -- * A convinient execution of requests + -- * A convenient execution of requests github, github', GitHubRW, @@ -121,10 +121,10 @@ import GitHub.Data.Request import Paths_github (version) ------------------------------------------------------------------------------- --- Convinience +-- Convenience ------------------------------------------------------------------------------- --- | A convinience function to turn functions returning @'Request' rw x@, +-- | A convenience function to turn functions returning @'Request' rw x@, -- into functions returning @IO (Either 'Error' x)@. -- -- >>> :t \auth -> github auth userInfoForR From c705c34e9fcdfc8e787fba95150eb9cceb02afd2 Mon Sep 17 00:00:00 2001 From: "Thomas M. DuBuisson" Date: Mon, 27 Apr 2020 22:46:27 -0700 Subject: [PATCH 025/121] Generalize PagedQuery to allow queries of any foldable semigroup. --- src/GitHub/Data/Request.hs | 2 +- src/GitHub/Request.hs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index 04f38339..4180a938 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -154,7 +154,7 @@ instance IReadOnly 'RA where iro = ROA -- /Note:/ 'Request' is not 'Functor' on purpose. data GenRequest (mt :: MediaType *) (rw :: RW) a where Query :: Paths -> QueryString -> GenRequest mt rw a - PagedQuery :: Paths -> QueryString -> FetchCount -> GenRequest mt rw (Vector a) + PagedQuery :: (a ~ t b, Foldable t, Semigroup a) => Paths -> QueryString -> FetchCount -> GenRequest mt rw a -- | Command Command diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index f0724d2c..4f58fa61 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -100,7 +100,6 @@ import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Data.Text.Encoding as TE -import qualified Data.Vector as V import qualified Network.HTTP.Client as HTTP import qualified Network.HTTP.Client.Internal as HTTP @@ -242,7 +241,7 @@ executeRequestWithMgrAndRes mgr auth req = runExceptT $ do performHttpReq httpReq (PagedQuery _ _ l) = unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) where - predicate v = lessFetchCount (V.length v) l + predicate v = lessFetchCount (length v) l performHttpReq httpReq (Command _ _ _) = do res <- httpLbs' httpReq From f3765823d99ed99111415e0af9b0cf3c9e4a0c5a Mon Sep 17 00:00:00 2001 From: Marco Perone Date: Fri, 15 May 2020 08:55:31 +0200 Subject: [PATCH 026/121] add endpoint for users search --- spec/GitHub/SearchSpec.hs | 12 ++++++++++-- src/GitHub.hs | 5 +---- src/GitHub/Endpoints/Search.hs | 7 +++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/spec/GitHub/SearchSpec.hs b/spec/GitHub/SearchSpec.hs index ce82900d..5cc5a15f 100644 --- a/spec/GitHub/SearchSpec.hs +++ b/spec/GitHub/SearchSpec.hs @@ -16,8 +16,9 @@ import qualified Data.Vector as V import GitHub (github) import GitHub.Data - (Auth (..), Issue (..), IssueNumber (..), IssueState (..), mkId) -import GitHub.Endpoints.Search (SearchResult (..), searchIssuesR) + (Auth (..), Issue (..), IssueNumber (..), IssueState (..), + SimpleUser (..), User, mkId) +import GitHub.Endpoints.Search (SearchResult (..), searchIssuesR, searchUsersR) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -57,3 +58,10 @@ spec = do issues <- searchResultResults . fromRightS <$> github auth searchIssuesR query length issues `shouldBe` 1 issueId (V.head issues) `shouldBe` mkId (Proxy :: Proxy Issue) 119694665 + + describe "searchUsers" $ + it "performs a user search via the API" $ withAuth $ \auth -> do + let query = "oleg.grenrus@iki.fi created:<2020-01-01" + users <- searchResultResults . fromRightS <$> github auth searchUsersR query + length users `shouldBe` 1 + simpleUserId (V.head users) `shouldBe` mkId (Proxy :: Proxy User) 51087 diff --git a/src/GitHub.hs b/src/GitHub.hs index 62c1ea6d..7fdcc111 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -355,13 +355,10 @@ module GitHub ( -- * Search -- | See - -- - -- Missing endpoints: - -- - -- * Search users searchReposR, searchCodeR, searchIssuesR, + searchUsersR, -- * Users -- | See diff --git a/src/GitHub/Endpoints/Search.hs b/src/GitHub/Endpoints/Search.hs index 26c134bd..3fb50e85 100644 --- a/src/GitHub/Endpoints/Search.hs +++ b/src/GitHub/Endpoints/Search.hs @@ -9,6 +9,7 @@ module GitHub.Endpoints.Search( searchReposR, searchCodeR, searchIssuesR, + searchUsersR, module GitHub.Data, ) where @@ -35,3 +36,9 @@ searchCodeR searchString = searchIssuesR :: Text -> Request k (SearchResult Issue) searchIssuesR searchString = query ["search", "issues"] [("q", Just $ TE.encodeUtf8 searchString)] + +-- | Search users. +-- See +searchUsersR :: Text -> Request k (SearchResult SimpleUser) +searchUsersR searchString = + query ["search", "users"] [("q", Just $ TE.encodeUtf8 searchString)] From 3a3f3b8a36d78d050bb7fb7f87b8dc74ce8f2877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 25 May 2020 13:55:07 +0200 Subject: [PATCH 027/121] Organizations: allow listing outside collaborators --- github.cabal | 1 + src/GitHub.hs | 6 ++++++ .../Organizations/OutsideCollaborators.hs | 21 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs diff --git a/github.cabal b/github.cabal index 643fcbb0..8ebe2b39 100644 --- a/github.cabal +++ b/github.cabal @@ -132,6 +132,7 @@ library GitHub.Endpoints.Issues.Milestones GitHub.Endpoints.Organizations GitHub.Endpoints.Organizations.Members + GitHub.Endpoints.Organizations.OutsideCollaborators GitHub.Endpoints.Organizations.Teams GitHub.Endpoints.PullRequests GitHub.Endpoints.PullRequests.Comments diff --git a/src/GitHub.hs b/src/GitHub.hs index 62c1ea6d..a5d7f454 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -175,6 +175,11 @@ module GitHub ( membersOfWithR, isMemberOfR, orgInvitationsR, + -- ** Outside Collaborators + -- | See + -- + -- Missing endpoints: All except /Outside Collaborator List/ + outsideCollaboratorsR, -- ** Teams -- | See @@ -433,6 +438,7 @@ import GitHub.Endpoints.Issues.Labels import GitHub.Endpoints.Issues.Milestones import GitHub.Endpoints.Organizations import GitHub.Endpoints.Organizations.Members +import GitHub.Endpoints.Organizations.OutsideCollaborators import GitHub.Endpoints.Organizations.Teams import GitHub.Endpoints.PullRequests import GitHub.Endpoints.PullRequests.Comments diff --git a/src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs b/src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs new file mode 100644 index 00000000..9bc392dd --- /dev/null +++ b/src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs @@ -0,0 +1,21 @@ +----------------------------------------------------------------------------- +-- | +-- License : BSD-3-Clause +-- Maintainer : Oleg Grenrus +-- +-- The organization members API as described on +-- . +module GitHub.Endpoints.Organizations.OutsideCollaborators ( + outsideCollaboratorsR, + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () + +-- | All the users who are outside collaborators of the specified organization. +-- +-- See +outsideCollaboratorsR :: Name Organization -> FetchCount -> Request k (Vector SimpleUser) +outsideCollaboratorsR organization = + pagedQuery ["orgs", toPathPart organization, "outside_collaborators"] [] From 1484325f652a1178e2a0bb6c5ef25da28d79820e Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Tue, 18 Feb 2020 22:19:39 +0200 Subject: [PATCH 028/121] Bump version --- CHANGELOG.md | 42 +++++++++++++++++++++++++++--------------- github.cabal | 2 +- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52400168..51e42146 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,14 @@ -## Changes for 0.24 - -**Major change**: -Introduce `github` n-ary combinator to hoist `... -> Request rw res` -into `... -> IO (Either Error res)` (i.e. n-ary `executeRequest`). -With that in place drop `.. -> IO (Either Error res)` functions. +## Changes for 0.26 -This reduces symbol bloat in the library. -[#415](https://github.com/phadej/github/pull/415) +- Generalize PagedQuery to allow its reuse by preview github APIs + [#439](https://github.com/phadej/github/pull/439) +- Add endpoint for listing organizations outside collaborators + [#445](https://github.com/phadej/github/pull/445) +- Add endpoint for users search + [#444](https://github.com/phadej/github/pull/444) + +## Changes for 0.25 -- Remove double `withOpenSSL` - [#414](https://github.com/phadej/github/pull/414) -- Pull requests reviews API uses issue number - [#409](https://github.com/phadej/github/pull/409) -- Update `Repo`, `NewRepo` and `EditRepo` data types - [#407](https://github.com/phadej/github/pull/407) - Add `executeRequestWithMgrAndRes` [#421](https://github.com/phadej/github/pull/421) - Add `limitsFromHttpResponse` @@ -29,10 +24,27 @@ This reduces symbol bloat in the library. - Add support for collaborator permission endpoint [#425](https://github.com/phadej/github/pull/425) - Add support for the comment reply endpoint - [#424](Add support for the comment reply endpoint) + [#424](https://github.com/phadej/github/pull/424) - Organise exports in `GitHub` [#430](https://github.com/phadej/github/pull/430) +## Changes for 0.24 + +**Major change**: +Introduce `github` n-ary combinator to hoist `... -> Request rw res` +into `... -> IO (Either Error res)` (i.e. n-ary `executeRequest`). +With that in place drop `.. -> IO (Either Error res)` functions. + +This reduces symbol bloat in the library. +[#415](https://github.com/phadej/github/pull/415) + +- Remove double `withOpenSSL` + [#414](https://github.com/phadej/github/pull/414) +- Pull requests reviews API uses issue number + [#409](https://github.com/phadej/github/pull/409) +- Update `Repo`, `NewRepo` and `EditRepo` data types + [#407](https://github.com/phadej/github/pull/407) + ## Changes for 0.23 - Escape URI paths diff --git a/github.cabal b/github.cabal index 8ebe2b39..1ff2e5ea 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: github -version: 0.24 +version: 0.26 synopsis: Access to the GitHub API, v3. category: Network description: From 59f9efe12c30960c3f435362d6cf026c5489b1e7 Mon Sep 17 00:00:00 2001 From: Doug Beardsley Date: Fri, 17 Apr 2020 07:58:33 -0400 Subject: [PATCH 029/121] Make repoWebhookResponseStatus optional I have encountered situations where the `repoWebhookResponseStatus` field returned by GitHub is `null` (in my case it was in last_response). When this happens, I get the following error: ``` ParseError "Error in $[1]['last_response'].status: expected Text, encountered Null" ``` Unfortunately I can't find anything in the documentation (https://developer.github.com/v3/repos/hooks/) indicating that the status field is nullable. At any rate, this PR fixes the problem for me. --- CHANGELOG.md | 3 +++ src/GitHub/Data/Webhooks.hs | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51e42146..12f7575f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ [#445](https://github.com/phadej/github/pull/445) - Add endpoint for users search [#444](https://github.com/phadej/github/pull/444) +- Make repoWebhookResponseStatus optional + [#436](https://github.com/phadej/github/pull/436) + ## Changes for 0.25 diff --git a/src/GitHub/Data/Webhooks.hs b/src/GitHub/Data/Webhooks.hs index e58f8e69..fb81969d 100644 --- a/src/GitHub/Data/Webhooks.hs +++ b/src/GitHub/Data/Webhooks.hs @@ -89,7 +89,7 @@ instance Binary RepoWebhookEvent data RepoWebhookResponse = RepoWebhookResponse { repoWebhookResponseCode :: !(Maybe Int) - , repoWebhookResponseStatus :: !Text + , repoWebhookResponseStatus :: !(Maybe Text) , repoWebhookResponseMessage :: !(Maybe Text) } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -254,8 +254,8 @@ instance FromJSON RepoWebhook where instance FromJSON RepoWebhookResponse where parseJSON = withObject "RepoWebhookResponse" $ \o -> RepoWebhookResponse <$> o .: "code" - <*> o .: "status" - <*> o .: "message" + <*> o .:? "status" + <*> o .:? "message" instance ToJSON NewRepoWebhook where toJSON (NewRepoWebhook { newRepoWebhookName = name From 5b12b032ba7a22948558b993f270d308ce9375cb Mon Sep 17 00:00:00 2001 From: Robbie McMichael <2044464+robbiemcmichael@users.noreply.github.com> Date: Tue, 3 Dec 2019 22:26:22 +1100 Subject: [PATCH 030/121] Fix permission field in types for teams Add privacy field to types for teams The privacy field was previously commented out while the privacy level of a team was part of the `ironman` API preview. This feature is now part of the official v3 API, so this commit adds support for this field. Make privacy field non-optional in teams The `privacy` field is optional when creating/editing teams, but has a context dependent default value. When getting the team details, the field is expected to always be populated due to these default values. Update team privacy/permission optionality Makes team `privacy` and `permission` fields required when creating a team so users are forced to choose, but optional when editing a team. Filter null values from types for teams --- CHANGELOG.md | 2 + samples/Organizations/Teams/CreateTeamFor.hs | 2 +- samples/Teams/EditTeam.hs | 2 +- src/GitHub/Data/Teams.hs | 48 ++++++++++++-------- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12f7575f..7d59fa1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ [#444](https://github.com/phadej/github/pull/444) - Make repoWebhookResponseStatus optional [#436](https://github.com/phadej/github/pull/436) +- Teams improvements + [#417](https://github.com/phadej/github/pull/417) ## Changes for 0.25 diff --git a/samples/Organizations/Teams/CreateTeamFor.hs b/samples/Organizations/Teams/CreateTeamFor.hs index 6004b100..df270bce 100644 --- a/samples/Organizations/Teams/CreateTeamFor.hs +++ b/samples/Organizations/Teams/CreateTeamFor.hs @@ -13,7 +13,7 @@ main = do Github.createTeamFor' (Github.OAuth token) org - (Github.CreateTeam team (Just desc) (read repos :: [String]) Github.PermissionPull) + (Github.CreateTeam team (Just desc) (read repos :: [String]) Github.PrivacyClosed Github.PermissionPull) _ -> error "usage: CreateTeamFor <[\"repos\"]>" case result of diff --git a/samples/Teams/EditTeam.hs b/samples/Teams/EditTeam.hs index bb0a05ca..7e83e5c9 100644 --- a/samples/Teams/EditTeam.hs +++ b/samples/Teams/EditTeam.hs @@ -15,7 +15,7 @@ main = do (GitHub.OAuth $ fromString token) GitHub.editTeamR (GitHub.mkTeamId $ read team_id) - (GitHub.EditTeam (GitHub.mkTeamName $ fromString team_name) (Just $ fromString desc) GitHub.PermissionPull) + (GitHub.EditTeam (GitHub.mkTeamName $ fromString team_name) (Just $ fromString desc) Nothing Nothing) _ -> error "usage: EditTeam " case result of diff --git a/src/GitHub/Data/Teams.hs b/src/GitHub/Data/Teams.hs index 387318e0..79ef9706 100644 --- a/src/GitHub/Data/Teams.hs +++ b/src/GitHub/Data/Teams.hs @@ -50,7 +50,7 @@ data SimpleTeam = SimpleTeam , simpleTeamName :: !Text -- TODO (0.15.0): unify this and 'simpleTeamSlug' as in 'Team'. , simpleTeamSlug :: !(Name Team) , simpleTeamDescription :: !(Maybe Text) - , simpleTeamPrivacy :: !(Maybe Privacy) + , simpleTeamPrivacy :: !Privacy , simpleTeamPermission :: !Permission , simpleTeamMembersUrl :: !URL , simpleTeamRepositoriesUrl :: !URL @@ -66,7 +66,7 @@ data Team = Team , teamName :: !Text , teamSlug :: !(Name Team) , teamDescription :: !(Maybe Text) - , teamPrivacy :: !(Maybe Privacy) + , teamPrivacy :: !Privacy , teamPermission :: !Permission , teamMembersUrl :: !URL , teamRepositoriesUrl :: !URL @@ -83,8 +83,8 @@ data CreateTeam = CreateTeam { createTeamName :: !(Name Team) , createTeamDescription :: !(Maybe Text) , createTeamRepoNames :: !(Vector (Name Repo)) - -- , createTeamPrivacy :: Privacy - , createTeamPermission :: Permission + , createTeamPrivacy :: !Privacy + , createTeamPermission :: !Permission } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -94,8 +94,8 @@ instance Binary CreateTeam data EditTeam = EditTeam { editTeamName :: !(Name Team) , editTeamDescription :: !(Maybe Text) - -- , editTeamPrivacy :: Privacy - , editTeamPermission :: !Permission + , editTeamPrivacy :: !(Maybe Privacy) + , editTeamPermission :: !(Maybe Permission) } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -144,7 +144,7 @@ instance FromJSON SimpleTeam where <*> o .: "name" <*> o .: "slug" <*> o .:?"description" .!= Nothing - <*> o .:?"privacy" .!= Nothing + <*> o .: "privacy" <*> o .: "permission" <*> o .: "members_url" <*> o .: "repositories_url" @@ -156,7 +156,7 @@ instance FromJSON Team where <*> o .: "name" <*> o .: "slug" <*> o .:?"description" .!= Nothing - <*> o .:?"privacy" .!= Nothing + <*> o .: "privacy" <*> o .: "permission" <*> o .: "members_url" <*> o .: "repositories_url" @@ -165,19 +165,29 @@ instance FromJSON Team where <*> o .: "organization" instance ToJSON CreateTeam where - toJSON (CreateTeam name desc repo_names {-privacy-} permissions) = - object [ "name" .= name - , "description" .= desc - , "repo_names" .= repo_names - {-, "privacy" .= privacy-} - , "permissions" .= permissions ] + toJSON (CreateTeam name desc repo_names privacy permission) = + object $ filter notNull + [ "name" .= name + , "description" .= desc + , "repo_names" .= repo_names + , "privacy" .= privacy + , "permission" .= permission + ] + where + notNull (_, Null) = False + notNull (_, _) = True instance ToJSON EditTeam where - toJSON (EditTeam name desc {-privacy-} permissions) = - object [ "name" .= name - , "description" .= desc - {-, "privacy" .= privacy-} - , "permissions" .= permissions ] + toJSON (EditTeam name desc privacy permission) = + object $ filter notNull + [ "name" .= name + , "description" .= desc + , "privacy" .= privacy + , "permission" .= permission + ] + where + notNull (_, Null) = False + notNull (_, _) = True instance FromJSON TeamMembership where parseJSON = withObject "TeamMembership" $ \o -> TeamMembership From ebc378a6b0453796606136ae2f9d47576fcd846b Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Tue, 18 Jun 2019 19:26:15 -0400 Subject: [PATCH 031/121] Change gitReferenceRef type to Name GitReference --- src/GitHub/Data/GitData.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub/Data/GitData.hs b/src/GitHub/Data/GitData.hs index bce1cb52..fa9973d1 100644 --- a/src/GitHub/Data/GitData.hs +++ b/src/GitHub/Data/GitData.hs @@ -156,7 +156,7 @@ instance Binary NewGitReference data GitReference = GitReference { gitReferenceObject :: !GitObject , gitReferenceUrl :: !URL - , gitReferenceRef :: !Text + , gitReferenceRef :: !(Name GitReference) } deriving (Show, Data, Typeable, Eq, Ord, Generic) From 9db8cf11dc4f2af5334800d99649872954b7ead7 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Tue, 18 Jun 2019 12:32:02 -0400 Subject: [PATCH 032/121] Add deleteReference --- CHANGELOG.md | 3 ++- src/GitHub.hs | 2 ++ src/GitHub/Endpoints/GitData/References.hs | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d59fa1f..991d24c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ [#436](https://github.com/phadej/github/pull/436) - Teams improvements [#417](https://github.com/phadej/github/pull/417) - +- Add deleteReference endpoint + [#388](https://github.com/phadej/github/pull/388) ## Changes for 0.25 diff --git a/src/GitHub.hs b/src/GitHub.hs index 646ecd98..6b5f8d36 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -100,6 +100,8 @@ module GitHub ( referenceR, referencesR, createReferenceR, + deleteReferenceR, + namespacedReferencesR, -- ** Trees -- | See diff --git a/src/GitHub/Endpoints/GitData/References.hs b/src/GitHub/Endpoints/GitData/References.hs index 270d8805..bf64657f 100644 --- a/src/GitHub/Endpoints/GitData/References.hs +++ b/src/GitHub/Endpoints/GitData/References.hs @@ -10,6 +10,7 @@ module GitHub.Endpoints.GitData.References ( referenceR, referencesR, createReferenceR, + deleteReferenceR, namespacedReferencesR, module GitHub.Data, ) where @@ -36,6 +37,12 @@ createReferenceR :: Name Owner -> Name Repo -> NewGitReference -> Request 'RW Gi createReferenceR user repo newRef = command Post ["repos", toPathPart user, toPathPart repo , "git", "refs"] (encode newRef) +-- | Delete a reference. +-- See +deleteReferenceR :: Name Owner -> Name Repo -> Name GitReference -> GenRequest 'MtUnit 'RW () +deleteReferenceR user repo ref = + Command Delete ["repos", toPathPart user, toPathPart repo , "git", "refs", toPathPart ref] mempty + -- | Query namespaced references. -- See namespacedReferencesR :: Name Owner -> Name Repo -> Text -> Request k [GitReference] From 878a452590dc00ac337d8390d1940f97be2d25c3 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Tue, 26 May 2020 22:32:00 +0300 Subject: [PATCH 033/121] Prepare for 0.26 --- .travis.yml | 109 +++++++++++++++++++---------------- github.cabal | 11 ++-- samples/github-samples.cabal | 3 +- 3 files changed, 67 insertions(+), 56 deletions(-) diff --git a/.travis.yml b/.travis.yml index 594e2d55..69a83ce4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,17 @@ # # haskell-ci '--config=cabal.haskell-ci' 'cabal.project' # +# To regenerate the script (for example after adjusting tested-with) run +# +# haskell-ci regenerate +# # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.5.20190908 +# version: 0.10.1 # +version: ~> 1.0 language: c +os: linux dist: xenial git: # whether to recursively clone submodules @@ -18,6 +24,7 @@ cache: directories: - $HOME/.cabal/packages - $HOME/.cabal/store + - $HOME/.hlint before_cache: - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log # remove files that are regenerated by 'cabal update' @@ -27,22 +34,32 @@ before_cache: - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx - rm -rfv $CABALHOME/packages/head.hackage -matrix: +jobs: include: - - compiler: ghc-8.8.1 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}} + - compiler: ghc-8.10.1 + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2"]}} + os: linux + - compiler: ghc-8.8.3 + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}} + os: linux - compiler: ghc-8.6.5 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}} + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}} + os: linux - compiler: ghc-8.4.4 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}} + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}} + os: linux - compiler: ghc-8.2.2 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}} + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}} + os: linux - compiler: ghc-8.0.2 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}} + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}} + os: linux - compiler: ghc-7.10.3 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-3.0"]}} + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.10.3","cabal-install-3.2"]}} + os: linux - compiler: ghc-7.8.4 - addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.8.4","cabal-install-3.0"]}} + addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.8.4","cabal-install-3.2"]}} + os: linux before_install: - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') - WITHCOMPILER="-w $HC" @@ -55,29 +72,8 @@ before_install: - TOP=$(pwd) - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')" - echo $HCNUMVER - - CABAL="$CABAL -vnormal+nowrap+markoutput" + - CABAL="$CABAL -vnormal+nowrap" - set -o pipefail - - | - echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk - echo 'BEGIN { state = "output"; }' >> .colorful.awk - echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk - echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk - echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk - echo ' if (state == "cabal") {' >> .colorful.awk - echo ' print blue($0)' >> .colorful.awk - echo ' } else {' >> .colorful.awk - echo ' print $0' >> .colorful.awk - echo ' }' >> .colorful.awk - echo '}' >> .colorful.awk - - cat .colorful.awk - - | - color_cabal_output () { - awk -f $TOP/.colorful.awk - } - - echo text | color_cabal_output -install: - - ${CABAL} --version - - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" - TEST=--enable-tests - BENCH=--enable-benchmarks - HEADHACKAGE=false @@ -98,6 +94,9 @@ install: echo " prefix: $CABALHOME" >> $CABALHOME/config echo "repository hackage.haskell.org" >> $CABALHOME/config echo " url: http://hackage.haskell.org/" >> $CABALHOME/config +install: + - ${CABAL} --version + - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" - | echo "program-default-options" >> $CABALHOME/config echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config @@ -110,25 +109,30 @@ install: - | echo "packages: ." >> cabal.project echo "packages: samples" >> cabal.project + - if [ $HCNUMVER -ge 80200 ] ; then echo 'package github' >> cabal.project ; fi + - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" + - if [ $HCNUMVER -ge 80200 ] ; then echo 'package github-samples' >> cabal.project ; fi + - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" - | - echo "constraints: hashable ^>=1.3" >> cabal.project - echo "constraints: semigroups ^>=0.19" >> cabal.project - echo "constraints: github +openssl" >> cabal.project - echo "optimization: False" >> cabal.project + echo "constraints: hashable ^>=1.3" >> cabal.project + echo "constraints: semigroups ^>=0.19" >> cabal.project + echo "constraints: github +openssl" >> cabal.project + echo "constraints: github-samples +openssl" >> cabal.project + echo "optimization: False" >> cabal.project - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(github|github-samples)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - cat cabal.project || true - cat cabal.project.local || true - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi - if [ -f "samples/configure.ac" ]; then (cd "samples" && autoreconf -i); fi - - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output + - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" - rm cabal.project.freeze - - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output + - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all + - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all script: - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) # Packaging... - - ${CABAL} v2-sdist all | color_cabal_output + - ${CABAL} v2-sdist all # Unpacking... - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ - cd ${DISTDIR} || false @@ -142,30 +146,35 @@ script: - | echo "packages: ${PKGDIR_github}" >> cabal.project echo "packages: ${PKGDIR_github_samples}" >> cabal.project + - if [ $HCNUMVER -ge 80200 ] ; then echo 'package github' >> cabal.project ; fi + - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" + - if [ $HCNUMVER -ge 80200 ] ; then echo 'package github-samples' >> cabal.project ; fi + - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" - | - echo "constraints: hashable ^>=1.3" >> cabal.project - echo "constraints: semigroups ^>=0.19" >> cabal.project - echo "constraints: github +openssl" >> cabal.project - echo "optimization: False" >> cabal.project + echo "constraints: hashable ^>=1.3" >> cabal.project + echo "constraints: semigroups ^>=0.19" >> cabal.project + echo "constraints: github +openssl" >> cabal.project + echo "constraints: github-samples +openssl" >> cabal.project + echo "optimization: False" >> cabal.project - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(github|github-samples)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - cat cabal.project || true - cat cabal.project.local || true # Building... # this builds all libraries and executables (without tests/benchmarks) - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all # Building with tests and benchmarks... # build & run tests, build benchmarks - - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all # Testing... - - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output + - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all # cabal check... - (cd ${PKGDIR_github} && ${CABAL} -vnormal check) - (cd ${PKGDIR_github_samples} && ${CABAL} -vnormal check) # haddock... - - if [ $HCNUMVER -ge 80600 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output ; fi + - if [ $HCNUMVER -ge 80600 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all ; fi # Building without installed constraints for packages in global-db... - rm -f cabal.project.local - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output + - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all -# REGENDATA ["--config=cabal.haskell-ci","cabal.project"] +# REGENDATA ("0.10.1",["--config=cabal.haskell-ci","cabal.project"]) # EOF diff --git a/github.cabal b/github.cabal index 1ff2e5ea..ed0045b0 100644 --- a/github.cabal +++ b/github.cabal @@ -36,7 +36,8 @@ tested-with: || ==8.2.2 || ==8.4.4 || ==8.6.5 - || ==8.8.1 + || ==8.8.3 + || ==8.10.1 extra-source-files: README.md @@ -163,7 +164,7 @@ library -- Packages bundles with GHC, mtl and text are also here build-depends: - base >=4.7 && <4.14 + base >=4.7 && <4.15 , binary >=0.7.1.0 && <0.11 , bytestring >=0.10.4.0 && <0.11 , containers >=0.5.5.1 && <0.7 @@ -175,15 +176,15 @@ library -- other packages build-depends: - aeson >=1.4.0.0 && <1.5 - , base-compat >=0.10.4 && <0.12 + aeson >=1.4.0.0 && <1.6 + , base-compat >=0.11.1 && <0.12 , base16-bytestring >=0.1.1.6 && <0.2 , binary-instances >=1 && <1.1 , cryptohash-sha1 >=0.11.100.1 && <0.12 , deepseq-generics >=0.2.0.0 && <0.3 , exceptions >=0.10.2 && <0.11 , hashable >=1.2.7.0 && <1.4 - , http-client >=0.5.12 && <0.7 + , http-client >=0.5.12 && <0.8 , http-link-header >=1.0.3.1 && <1.1 , http-types >=0.12.3 && <0.13 , iso8601-time >=0.1.5 && <0.2 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index ae4fb3f2..41d6dccf 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -15,7 +15,8 @@ tested-with: || ==8.2.2 || ==8.4.4 || ==8.6.5 - || ==8.8.1 + || ==8.8.3 + || ==8.10.1 library hs-source-dirs: src From 5277e66ad07b37e0745c18c2370ea7d74ec02b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 20 Jul 2020 13:47:23 +0200 Subject: [PATCH 034/121] typos --- src/GitHub/Data/Definitions.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub/Data/Definitions.hs b/src/GitHub/Data/Definitions.hs index 8da8b761..0d56171b 100644 --- a/src/GitHub/Data/Definitions.hs +++ b/src/GitHub/Data/Definitions.hs @@ -121,7 +121,7 @@ data Organization = Organization instance NFData Organization where rnf = genericRnf instance Binary Organization --- | In practic, you cam't have concrete values of 'Owner'. +-- | In practice you can't have concrete values of 'Owner'. newtype Owner = Owner (Either User Organization) deriving (Show, Data, Typeable, Eq, Ord, Generic) From f5c0dd6be826f3beb10924da829c0e210c00ac33 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves <2335822+alexfmpe@users.noreply.github.com> Date: Tue, 28 Jul 2020 11:23:29 +0100 Subject: [PATCH 035/121] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc825f98..d6996412 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ For details see the reference [documentation on Hackage][hackage]. Each module lines up with the hierarchy of [documentation from the Github API](http://developer.github.com/v3/). -Request functions (ending with `R`) construct a data type with can be executed +Request functions (ending with `R`) construct a data type which can be executed in `IO` by `executeRequest` functions. They are all listed in the root `GitHub` module. From 514b175851dd7c4a9722ff203dd6f652a15d33e8 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Thu, 22 Oct 2020 13:09:14 +0300 Subject: [PATCH 036/121] Update dependencies 20201022 --- github.cabal | 4 ++-- src/GitHub/Request.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/github.cabal b/github.cabal index ed0045b0..1b4f2e40 100644 --- a/github.cabal +++ b/github.cabal @@ -178,14 +178,14 @@ library build-depends: aeson >=1.4.0.0 && <1.6 , base-compat >=0.11.1 && <0.12 - , base16-bytestring >=0.1.1.6 && <0.2 + , base16-bytestring >=0.1.1.6 && <1.1 , binary-instances >=1 && <1.1 , cryptohash-sha1 >=0.11.100.1 && <0.12 , deepseq-generics >=0.2.0.0 && <0.3 , exceptions >=0.10.2 && <0.11 , hashable >=1.2.7.0 && <1.4 , http-client >=0.5.12 && <0.8 - , http-link-header >=1.0.3.1 && <1.1 + , http-link-header >=1.0.3.1 && <1.3 , http-types >=0.12.3 && <0.13 , iso8601-time >=0.1.5 && <0.2 , network-uri >=2.6.1.0 && <2.7 diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index 4f58fa61..808f33a7 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -90,7 +90,7 @@ import Network.HTTP.Client httpLbs, method, newManager, redirectCount, requestBody, requestHeaders, setQueryString, setRequestIgnoreStatus) import Network.HTTP.Link.Parser (parseLinkHeaderBS) -import Network.HTTP.Link.Types (Link (..), LinkParam (..), href, linkParams) +import Network.HTTP.Link.Types (LinkParam (..), href, linkParams) import Network.HTTP.Types (Method, RequestHeaders, Status (..)) import Network.URI (URI, escapeURIString, isUnescapedInURIComponent, parseURIReference, @@ -507,7 +507,7 @@ getNextUrl req = do nextURI <- find isRelNext links return $ href nextURI where - isRelNext :: Link -> Bool + -- isRelNext :: Link -> Bool or Link uri -> Bool isRelNext = any (== relNextLinkParam) . linkParams relNextLinkParam :: (LinkParam, Text) From f18d8ac45191c8cfa0105e8d364e994480b1df96 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 2 Dec 2020 18:33:27 -0500 Subject: [PATCH 037/121] Add vector of SimpleTeam in "requested_teams" field of PullRequest --- .../pull-request-team-review-requested.json | 362 ++++++++++++++++++ spec/GitHub/PullRequestsSpec.hs | 18 + src/GitHub/Data/PullRequests.hs | 5 + 3 files changed, 385 insertions(+) create mode 100644 fixtures/pull-request-team-review-requested.json diff --git a/fixtures/pull-request-team-review-requested.json b/fixtures/pull-request-team-review-requested.json new file mode 100644 index 00000000..7eeb71f7 --- /dev/null +++ b/fixtures/pull-request-team-review-requested.json @@ -0,0 +1,362 @@ +{ + "url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910", + "id": 529597962, + "node_id": "MDExOlB1bGxSZXF1ZXN0NTI5NTk3OTYy", + "html_url": "https://github.com/tahoe-lafs/tahoe-lafs/pull/910", + "diff_url": "https://github.com/tahoe-lafs/tahoe-lafs/pull/910.diff", + "patch_url": "https://github.com/tahoe-lafs/tahoe-lafs/pull/910.patch", + "issue_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/910", + "number": 910, + "state": "open", + "locked": false, + "title": "Fix NodeMaker's use of the WeakValueDictionary", + "user": { + "login": "exarkun", + "id": 254565, + "node_id": "MDQ6VXNlcjI1NDU2NQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/254565?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/exarkun", + "html_url": "https://github.com/exarkun", + "followers_url": "https://api.github.com/users/exarkun/followers", + "following_url": "https://api.github.com/users/exarkun/following{/other_user}", + "gists_url": "https://api.github.com/users/exarkun/gists{/gist_id}", + "starred_url": "https://api.github.com/users/exarkun/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/exarkun/subscriptions", + "organizations_url": "https://api.github.com/users/exarkun/orgs", + "repos_url": "https://api.github.com/users/exarkun/repos", + "events_url": "https://api.github.com/users/exarkun/events{/privacy}", + "received_events_url": "https://api.github.com/users/exarkun/received_events", + "type": "User", + "site_admin": false + }, + "body": "https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3539", + "created_at": "2020-11-30T14:46:37Z", + "updated_at": "2020-12-02T17:23:41Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "3c97064ee5f71357c88f7940a91da8859641c2c6", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + { + "name": "Tahoe Committers", + "id": 121616, + "node_id": "MDQ6VGVhbTEyMTYxNg==", + "slug": "tahoe-committers", + "description": null, + "privacy": "closed", + "url": "https://api.github.com/organizations/1156454/team/121616", + "html_url": "https://github.com/orgs/tahoe-lafs/teams/tahoe-committers", + "members_url": "https://api.github.com/organizations/1156454/team/121616/members{/member}", + "repositories_url": "https://api.github.com/organizations/1156454/team/121616/repos", + "permission": "push", + "parent": null + } + ], + "labels": [ + + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910/commits", + "review_comments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910/comments", + "review_comment_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/910/comments", + "statuses_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/ef2f7e61364c6a3187d2ab4859adfc4031213bdd", + "head": { + "label": "tahoe-lafs:3539.nodemaker-weakrefdict", + "ref": "3539.nodemaker-weakrefdict", + "sha": "ef2f7e61364c6a3187d2ab4859adfc4031213bdd", + "user": { + "login": "tahoe-lafs", + "id": 1156454, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNTY0NTQ=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1156454?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/tahoe-lafs", + "html_url": "https://github.com/tahoe-lafs", + "followers_url": "https://api.github.com/users/tahoe-lafs/followers", + "following_url": "https://api.github.com/users/tahoe-lafs/following{/other_user}", + "gists_url": "https://api.github.com/users/tahoe-lafs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/tahoe-lafs/subscriptions", + "organizations_url": "https://api.github.com/users/tahoe-lafs/orgs", + "repos_url": "https://api.github.com/users/tahoe-lafs/repos", + "events_url": "https://api.github.com/users/tahoe-lafs/events{/privacy}", + "received_events_url": "https://api.github.com/users/tahoe-lafs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 3007569, + "node_id": "MDEwOlJlcG9zaXRvcnkzMDA3NTY5", + "name": "tahoe-lafs", + "full_name": "tahoe-lafs/tahoe-lafs", + "private": false, + "owner": { + "login": "tahoe-lafs", + "id": 1156454, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNTY0NTQ=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1156454?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/tahoe-lafs", + "html_url": "https://github.com/tahoe-lafs", + "followers_url": "https://api.github.com/users/tahoe-lafs/followers", + "following_url": "https://api.github.com/users/tahoe-lafs/following{/other_user}", + "gists_url": "https://api.github.com/users/tahoe-lafs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/tahoe-lafs/subscriptions", + "organizations_url": "https://api.github.com/users/tahoe-lafs/orgs", + "repos_url": "https://api.github.com/users/tahoe-lafs/repos", + "events_url": "https://api.github.com/users/tahoe-lafs/events{/privacy}", + "received_events_url": "https://api.github.com/users/tahoe-lafs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/tahoe-lafs/tahoe-lafs", + "description": "The Tahoe-LAFS decentralized secure filesystem.", + "fork": false, + "url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs", + "forks_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/forks", + "keys_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/teams", + "hooks_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/hooks", + "issue_events_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/events{/number}", + "events_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/events", + "assignees_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/assignees{/user}", + "branches_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/branches{/branch}", + "tags_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/tags", + "blobs_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/{sha}", + "languages_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/languages", + "stargazers_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/stargazers", + "contributors_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contributors", + "subscribers_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscribers", + "subscription_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscription", + "commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contents/{+path}", + "compare_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/merges", + "archive_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/downloads", + "issues_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues{/number}", + "pulls_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls{/number}", + "milestones_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/milestones{/number}", + "notifications_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/labels{/name}", + "releases_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/releases{/id}", + "deployments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/deployments", + "created_at": "2011-12-18T19:33:55Z", + "updated_at": "2020-12-02T20:24:23Z", + "pushed_at": "2020-12-02T20:27:05Z", + "git_url": "git://github.com/tahoe-lafs/tahoe-lafs.git", + "ssh_url": "git@github.com:tahoe-lafs/tahoe-lafs.git", + "clone_url": "https://github.com/tahoe-lafs/tahoe-lafs.git", + "svn_url": "https://github.com/tahoe-lafs/tahoe-lafs", + "homepage": "https://tahoe-lafs.org/", + "size": 73606, + "stargazers_count": 1018, + "watchers_count": 1018, + "language": "Python", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 236, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 21, + "license": { + "key": "other", + "name": "Other", + "spdx_id": "NOASSERTION", + "url": null, + "node_id": "MDc6TGljZW5zZTA=" + }, + "forks": 236, + "open_issues": 21, + "watchers": 1018, + "default_branch": "master" + } + }, + "base": { + "label": "tahoe-lafs:master", + "ref": "master", + "sha": "fba386cb8ee2b48a34c0d954b5c6b5b080d3234e", + "user": { + "login": "tahoe-lafs", + "id": 1156454, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNTY0NTQ=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1156454?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/tahoe-lafs", + "html_url": "https://github.com/tahoe-lafs", + "followers_url": "https://api.github.com/users/tahoe-lafs/followers", + "following_url": "https://api.github.com/users/tahoe-lafs/following{/other_user}", + "gists_url": "https://api.github.com/users/tahoe-lafs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/tahoe-lafs/subscriptions", + "organizations_url": "https://api.github.com/users/tahoe-lafs/orgs", + "repos_url": "https://api.github.com/users/tahoe-lafs/repos", + "events_url": "https://api.github.com/users/tahoe-lafs/events{/privacy}", + "received_events_url": "https://api.github.com/users/tahoe-lafs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 3007569, + "node_id": "MDEwOlJlcG9zaXRvcnkzMDA3NTY5", + "name": "tahoe-lafs", + "full_name": "tahoe-lafs/tahoe-lafs", + "private": false, + "owner": { + "login": "tahoe-lafs", + "id": 1156454, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjExNTY0NTQ=", + "avatar_url": "https://avatars1.githubusercontent.com/u/1156454?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/tahoe-lafs", + "html_url": "https://github.com/tahoe-lafs", + "followers_url": "https://api.github.com/users/tahoe-lafs/followers", + "following_url": "https://api.github.com/users/tahoe-lafs/following{/other_user}", + "gists_url": "https://api.github.com/users/tahoe-lafs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/tahoe-lafs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/tahoe-lafs/subscriptions", + "organizations_url": "https://api.github.com/users/tahoe-lafs/orgs", + "repos_url": "https://api.github.com/users/tahoe-lafs/repos", + "events_url": "https://api.github.com/users/tahoe-lafs/events{/privacy}", + "received_events_url": "https://api.github.com/users/tahoe-lafs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/tahoe-lafs/tahoe-lafs", + "description": "The Tahoe-LAFS decentralized secure filesystem.", + "fork": false, + "url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs", + "forks_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/forks", + "keys_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/teams", + "hooks_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/hooks", + "issue_events_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/events{/number}", + "events_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/events", + "assignees_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/assignees{/user}", + "branches_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/branches{/branch}", + "tags_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/tags", + "blobs_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/{sha}", + "languages_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/languages", + "stargazers_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/stargazers", + "contributors_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contributors", + "subscribers_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscribers", + "subscription_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/subscription", + "commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/contents/{+path}", + "compare_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/merges", + "archive_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/downloads", + "issues_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues{/number}", + "pulls_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls{/number}", + "milestones_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/milestones{/number}", + "notifications_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/labels{/name}", + "releases_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/releases{/id}", + "deployments_url": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/deployments", + "created_at": "2011-12-18T19:33:55Z", + "updated_at": "2020-12-02T20:24:23Z", + "pushed_at": "2020-12-02T20:27:05Z", + "git_url": "git://github.com/tahoe-lafs/tahoe-lafs.git", + "ssh_url": "git@github.com:tahoe-lafs/tahoe-lafs.git", + "clone_url": "https://github.com/tahoe-lafs/tahoe-lafs.git", + "svn_url": "https://github.com/tahoe-lafs/tahoe-lafs", + "homepage": "https://tahoe-lafs.org/", + "size": 73606, + "stargazers_count": 1018, + "watchers_count": 1018, + "language": "Python", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "forks_count": 236, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 21, + "license": { + "key": "other", + "name": "Other", + "spdx_id": "NOASSERTION", + "url": null, + "node_id": "MDc6TGljZW5zZTA=" + }, + "forks": 236, + "open_issues": 21, + "watchers": 1018, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910" + }, + "html": { + "href": "https://github.com/tahoe-lafs/tahoe-lafs/pull/910" + }, + "issue": { + "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/910" + }, + "comments": { + "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/issues/910/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/pulls/910/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/tahoe-lafs/tahoe-lafs/statuses/ef2f7e61364c6a3187d2ab4859adfc4031213bdd" + } + }, + "author_association": "MEMBER", + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 1, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 5, + "additions": 223, + "deletions": 4, + "changed_files": 5 +} diff --git a/spec/GitHub/PullRequestsSpec.hs b/spec/GitHub/PullRequestsSpec.hs index 14cbee9a..7a49bc97 100644 --- a/spec/GitHub/PullRequestsSpec.hs +++ b/spec/GitHub/PullRequestsSpec.hs @@ -65,6 +65,13 @@ spec = do V.length (GH.pullRequestRequestedReviewers pullRequestReviewRequested) `shouldBe` 1 + it "decodes a pull request 'team_requested' payload" $ do + V.length (GH.simplePullRequestRequestedTeamReviewers simplePullRequestTeamReviewRequested) + `shouldBe` 1 + + V.length (GH.pullRequestRequestedTeamReviewers pullRequestTeamReviewRequested) + `shouldBe` 1 + describe "checking if a pull request is merged" $ do it "works" $ withAuth $ \auth -> do b <- GH.executeRequest auth $ GH.isPullRequestMergedR "phadej" "github" (GH.IssueNumber 14) @@ -97,16 +104,27 @@ spec = do simplePullRequestReviewRequested = fromRightS (eitherDecodeStrict prReviewRequestedPayload) + simplePullRequestTeamReviewRequested :: GH.SimplePullRequest + simplePullRequestTeamReviewRequested = + fromRightS (eitherDecodeStrict prTeamReviewRequestedPayload) + pullRequestReviewRequested :: GH.PullRequest pullRequestReviewRequested = fromRightS (eitherDecodeStrict prReviewRequestedPayload) + pullRequestTeamReviewRequested :: GH.PullRequest + pullRequestTeamReviewRequested = + fromRightS (eitherDecodeStrict prTeamReviewRequestedPayload) + prOpenedPayload :: ByteString prOpenedPayload = $(embedFile "fixtures/pull-request-opened.json") prReviewRequestedPayload :: ByteString prReviewRequestedPayload = $(embedFile "fixtures/pull-request-review-requested.json") + prTeamReviewRequestedPayload :: ByteString + prTeamReviewRequestedPayload = $(embedFile "fixtures/pull-request-team-review-requested.json") + ------------------------------------------------------------------------------- -- Draft Pull Requests ------------------------------------------------------------------------------- diff --git a/src/GitHub/Data/PullRequests.hs b/src/GitHub/Data/PullRequests.hs index 5c2f62e1..0075986a 100644 --- a/src/GitHub/Data/PullRequests.hs +++ b/src/GitHub/Data/PullRequests.hs @@ -21,6 +21,7 @@ import GitHub.Data.Id (Id) import GitHub.Data.Options (IssueState (..), MergeableState (..)) import GitHub.Data.Repos (Repo) import GitHub.Data.URL (URL) +import GitHub.Data.Teams (SimpleTeam) import GitHub.Internal.Prelude import Prelude () @@ -38,6 +39,7 @@ data SimplePullRequest = SimplePullRequest , simplePullRequestBody :: !(Maybe Text) , simplePullRequestAssignees :: (Vector SimpleUser) , simplePullRequestRequestedReviewers :: (Vector SimpleUser) + , simplePullRequestRequestedTeamReviewers:: (Vector SimpleTeam) , simplePullRequestIssueUrl :: !URL , simplePullRequestDiffUrl :: !URL , simplePullRequestUrl :: !URL @@ -63,6 +65,7 @@ data PullRequest = PullRequest , pullRequestBody :: !(Maybe Text) , pullRequestAssignees :: (Vector SimpleUser) , pullRequestRequestedReviewers :: (Vector SimpleUser) + , pullRequestRequestedTeamReviewers :: (Vector SimpleTeam) , pullRequestIssueUrl :: !URL , pullRequestDiffUrl :: !URL , pullRequestUrl :: !URL @@ -198,6 +201,7 @@ instance FromJSON SimplePullRequest where <*> o .:? "body" <*> o .: "assignees" <*> o .:? "requested_reviewers" .!= mempty + <*> o .:? "requested_teams" .!= mempty <*> o .: "issue_url" <*> o .: "diff_url" <*> o .: "url" @@ -239,6 +243,7 @@ instance FromJSON PullRequest where <*> o .:? "body" <*> o .: "assignees" <*> o .:? "requested_reviewers" .!= mempty + <*> o .:? "requested_teams" .!= mempty <*> o .: "issue_url" <*> o .: "diff_url" <*> o .: "url" From a6a76128dfdc99560cbdf7a42936087aae1120e9 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Wed, 2 Dec 2020 19:20:15 -0500 Subject: [PATCH 038/121] Attempt to get the new data fixture where it needs to be --- github.cabal | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/github.cabal b/github.cabal index 1b4f2e40..d0fd875f 100644 --- a/github.cabal +++ b/github.cabal @@ -42,14 +42,7 @@ tested-with: extra-source-files: README.md CHANGELOG.md - fixtures/issue-search.json - fixtures/list-teams.json - fixtures/members-list.json - fixtures/pull-request-opened.json - fixtures/pull-request-review-requested.json - fixtures/user-organizations.json - fixtures/user.json - fixtures/user-bot.json + fixtures/*.json source-repository head type: git From b060eca8855010a3ba3bb2b17702343e1d54e437 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Mon, 14 Dec 2020 20:06:30 +0200 Subject: [PATCH 039/121] Use GitHub Actions --- .github/workflows/haskell-ci.yml | 181 +++++++++++++++++++++++++++++++ .travis.yml | 180 ------------------------------ 2 files changed, 181 insertions(+), 180 deletions(-) create mode 100644 .github/workflows/haskell-ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml new file mode 100644 index 00000000..2dd020d0 --- /dev/null +++ b/.github/workflows/haskell-ci.yml @@ -0,0 +1,181 @@ +# This GitHub workflow config has been generated by a script via +# +# haskell-ci '--config=cabal.haskell-ci' 'github' 'cabal.project' +# +# To regenerate the script (for example after adjusting tested-with) run +# +# haskell-ci regenerate +# +# For more information, see https://github.com/haskell-CI/haskell-ci +# +# version: 0.11.20201213 +# +# REGENDATA ("0.11.20201213",["--config=cabal.haskell-ci","github","cabal.project"]) +# +name: Haskell-CI +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + linux: + name: Haskell-CI Linux + runs-on: ubuntu-18.04 + container: + image: buildpack-deps:bionic + strategy: + matrix: + include: + - ghc: 8.10.1 + - ghc: 8.8.3 + - ghc: 8.6.5 + - ghc: 8.4.4 + - ghc: 8.2.2 + - ghc: 8.0.2 + - ghc: 7.10.3 + - ghc: 7.8.4 + fail-fast: false + steps: + - name: apt + run: | + apt-get update + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common + apt-add-repository -y 'ppa:hvr/ghc' + apt-get update + apt-get install -y ghc-$GHC_VERSION cabal-install-3.2 + env: + GHC_VERSION: ${{ matrix.ghc }} + - name: Set PATH and environment variables + run: | + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + echo "LANG=C.UTF-8" >> $GITHUB_ENV + echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV + echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV + HC=/opt/ghc/$GHC_VERSION/bin/ghc + echo "HC=$HC" >> $GITHUB_ENV + echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV + echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV + echo "CABAL=/opt/cabal/3.2/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV + HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') + echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV + echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV + echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV + echo "ARG_COMPILER=--ghc --with-compiler=/opt/ghc/$GHC_VERSION/bin/ghc" >> $GITHUB_ENV + echo "GHCJSARITH=0" >> $GITHUB_ENV + env: + GHC_VERSION: ${{ matrix.ghc }} + - name: env + run: | + env + - name: write cabal config + run: | + mkdir -p $CABAL_DIR + cat >> $CABAL_CONFIG < cabal-plan.xz + echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan + rm -f cabal-plan.xz + chmod a+x $HOME/.cabal/bin/cabal-plan + - name: checkout + uses: actions/checkout@v2 + with: + path: source + - name: sdist + run: | + mkdir -p sdist + cd source || false + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist + - name: unpack + run: | + mkdir -p unpacked + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; + - name: generate cabal.project + run: | + PKGDIR_github="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/github-[0-9.]*')" + echo "PKGDIR_github=${PKGDIR_github}" >> $GITHUB_ENV + PKGDIR_github_samples="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/github-samples-[0-9.]*')" + echo "PKGDIR_github_samples=${PKGDIR_github_samples}" >> $GITHUB_ENV + touch cabal.project + touch cabal.project.local + echo "packages: ${PKGDIR_github}" >> cabal.project + echo "packages: ${PKGDIR_github_samples}" >> cabal.project + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + cat >> cabal.project <=1.3 + constraints: semigroups ^>=0.19 + constraints: github +openssl + constraints: github-samples +openssl + optimization: False + EOF + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local + cat cabal.project + cat cabal.project.local + - name: dump install plan + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all + cabal-plan + - name: cache + uses: actions/cache@v2 + with: + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} + path: ~/.cabal/store + restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- + - name: install dependencies + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only all + - name: build w/o tests + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: build + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all + - name: tests + run: | + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct + - name: cabal check + run: | + cd ${PKGDIR_github} || false + ${CABAL} -vnormal check + cd ${PKGDIR_github_samples} || false + ${CABAL} -vnormal check + - name: haddock + run: | + if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi + - name: unconstrained build + run: | + rm -f cabal.project.local + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 69a83ce4..00000000 --- a/.travis.yml +++ /dev/null @@ -1,180 +0,0 @@ -# This Travis job script has been generated by a script via -# -# haskell-ci '--config=cabal.haskell-ci' 'cabal.project' -# -# To regenerate the script (for example after adjusting tested-with) run -# -# haskell-ci regenerate -# -# For more information, see https://github.com/haskell-CI/haskell-ci -# -# version: 0.10.1 -# -version: ~> 1.0 -language: c -os: linux -dist: xenial -git: - # whether to recursively clone submodules - submodules: false -branches: - only: - - master -cache: - directories: - - $HOME/.cabal/packages - - $HOME/.cabal/store - - $HOME/.hlint -before_cache: - - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log - # remove files that are regenerated by 'cabal update' - - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.* - - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json - - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache - - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar - - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx - - rm -rfv $CABALHOME/packages/head.hackage -jobs: - include: - - compiler: ghc-8.10.1 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2"]}} - os: linux - - compiler: ghc-8.8.3 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}} - os: linux - - compiler: ghc-8.6.5 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}} - os: linux - - compiler: ghc-8.4.4 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}} - os: linux - - compiler: ghc-8.2.2 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}} - os: linux - - compiler: ghc-8.0.2 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}} - os: linux - - compiler: ghc-7.10.3 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.10.3","cabal-install-3.2"]}} - os: linux - - compiler: ghc-7.8.4 - addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.8.4","cabal-install-3.2"]}} - os: linux -before_install: - - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//') - - WITHCOMPILER="-w $HC" - - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//') - - HCPKG="$HC-pkg" - - unset CC - - CABAL=/opt/ghc/bin/cabal - - CABALHOME=$HOME/.cabal - - export PATH="$CABALHOME/bin:$PATH" - - TOP=$(pwd) - - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')" - - echo $HCNUMVER - - CABAL="$CABAL -vnormal+nowrap" - - set -o pipefail - - TEST=--enable-tests - - BENCH=--enable-benchmarks - - HEADHACKAGE=false - - rm -f $CABALHOME/config - - | - echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config - echo "remote-build-reporting: anonymous" >> $CABALHOME/config - echo "write-ghc-environment-files: always" >> $CABALHOME/config - echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config - echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config - echo "world-file: $CABALHOME/world" >> $CABALHOME/config - echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config - echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config - echo "installdir: $CABALHOME/bin" >> $CABALHOME/config - echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config - echo "store-dir: $CABALHOME/store" >> $CABALHOME/config - echo "install-dirs user" >> $CABALHOME/config - echo " prefix: $CABALHOME" >> $CABALHOME/config - echo "repository hackage.haskell.org" >> $CABALHOME/config - echo " url: http://hackage.haskell.org/" >> $CABALHOME/config -install: - - ${CABAL} --version - - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" - - | - echo "program-default-options" >> $CABALHOME/config - echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config - - cat $CABALHOME/config - - rm -fv cabal.project cabal.project.local cabal.project.freeze - - travis_retry ${CABAL} v2-update -v - # Generate cabal.project - - rm -rf cabal.project cabal.project.local cabal.project.freeze - - touch cabal.project - - | - echo "packages: ." >> cabal.project - echo "packages: samples" >> cabal.project - - if [ $HCNUMVER -ge 80200 ] ; then echo 'package github' >> cabal.project ; fi - - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" - - if [ $HCNUMVER -ge 80200 ] ; then echo 'package github-samples' >> cabal.project ; fi - - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" - - | - echo "constraints: hashable ^>=1.3" >> cabal.project - echo "constraints: semigroups ^>=0.19" >> cabal.project - echo "constraints: github +openssl" >> cabal.project - echo "constraints: github-samples +openssl" >> cabal.project - echo "optimization: False" >> cabal.project - - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(github|github-samples)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - - cat cabal.project || true - - cat cabal.project.local || true - - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi - - if [ -f "samples/configure.ac" ]; then (cd "samples" && autoreconf -i); fi - - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} - - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'" - - rm cabal.project.freeze - - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all - - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all -script: - - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) - # Packaging... - - ${CABAL} v2-sdist all - # Unpacking... - - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ - - cd ${DISTDIR} || false - - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \; - - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \; - - PKGDIR_github="$(find . -maxdepth 1 -type d -regex '.*/github-[0-9.]*')" - - PKGDIR_github_samples="$(find . -maxdepth 1 -type d -regex '.*/github-samples-[0-9.]*')" - # Generate cabal.project - - rm -rf cabal.project cabal.project.local cabal.project.freeze - - touch cabal.project - - | - echo "packages: ${PKGDIR_github}" >> cabal.project - echo "packages: ${PKGDIR_github_samples}" >> cabal.project - - if [ $HCNUMVER -ge 80200 ] ; then echo 'package github' >> cabal.project ; fi - - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" - - if [ $HCNUMVER -ge 80200 ] ; then echo 'package github-samples' >> cabal.project ; fi - - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi" - - | - echo "constraints: hashable ^>=1.3" >> cabal.project - echo "constraints: semigroups ^>=0.19" >> cabal.project - echo "constraints: github +openssl" >> cabal.project - echo "constraints: github-samples +openssl" >> cabal.project - echo "optimization: False" >> cabal.project - - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(github|github-samples)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done" - - cat cabal.project || true - - cat cabal.project.local || true - # Building... - # this builds all libraries and executables (without tests/benchmarks) - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all - # Building with tests and benchmarks... - # build & run tests, build benchmarks - - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all - # Testing... - - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all - # cabal check... - - (cd ${PKGDIR_github} && ${CABAL} -vnormal check) - - (cd ${PKGDIR_github_samples} && ${CABAL} -vnormal check) - # haddock... - - if [ $HCNUMVER -ge 80600 ] ; then ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all ; fi - # Building without installed constraints for packages in global-db... - - rm -f cabal.project.local - - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all - -# REGENDATA ("0.10.1",["--config=cabal.haskell-ci","cabal.project"]) -# EOF From c7960f4eea56365bf10239a61ebc45b7ce24cc9d Mon Sep 17 00:00:00 2001 From: MATSUBARA Nobutada Date: Thu, 31 Dec 2020 01:20:48 +0900 Subject: [PATCH 040/121] Add endpoint to create gist --- src/GitHub.hs | 2 +- src/GitHub/Data/Gists.hs | 29 +++++++++++++++++++++++++++++ src/GitHub/Endpoints/Gists.hs | 6 ++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/GitHub.hs b/src/GitHub.hs index 6b5f8d36..e00a53cb 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -62,7 +62,6 @@ module GitHub ( -- Missing endpoints: -- -- * Query a specific revision of a gist - -- * Create a gist -- * Edit a gist -- * List gist commits -- * Check if a gist is starred @@ -70,6 +69,7 @@ module GitHub ( -- * List gist forks gistsR, gistR, + createGistR, starGistR, unstarGistR, deleteGistR, diff --git a/src/GitHub/Data/Gists.hs b/src/GitHub/Data/Gists.hs index 3e1fbe79..04c98bae 100644 --- a/src/GitHub/Data/Gists.hs +++ b/src/GitHub/Data/Gists.hs @@ -89,3 +89,32 @@ instance FromJSON GistComment where <*> o .: "body" <*> o .: "updated_at" <*> o .: "id" + +data NewGist = NewGist + { newGistDescription :: !Text + , newGistFiles :: !(HashMap Text NewGistFile) + , newGistPublic :: !Bool + } deriving (Show, Data, Typeable, Eq, Generic) + +instance NFData NewGist where rnf = genericRnf +instance Binary NewGist + +instance ToJSON NewGist where + toJSON (NewGist { newGistDescription = description + , newGistFiles = files + , newGistPublic = public + }) = object + [ "description" .= description + , "files" .= files + , "public" .= public + ] + +data NewGistFile = NewGistFile + { newGistFileContent :: !Text + } deriving (Show, Data, Typeable, Eq, Generic) + +instance NFData NewGistFile where rnf = genericRnf +instance Binary NewGistFile + +instance ToJSON NewGistFile where + toJSON (NewGistFile c) = object ["content" .= c] diff --git a/src/GitHub/Endpoints/Gists.hs b/src/GitHub/Endpoints/Gists.hs index 783e0588..de8e6c20 100644 --- a/src/GitHub/Endpoints/Gists.hs +++ b/src/GitHub/Endpoints/Gists.hs @@ -7,6 +7,7 @@ module GitHub.Endpoints.Gists ( gistsR, gistR, + createGistR, starGistR, unstarGistR, deleteGistR, @@ -28,6 +29,11 @@ gistR :: Name Gist -> Request k Gist gistR gid = query ["gists", toPathPart gid] [] +-- | Create a new gist +-- See +createGistR :: NewGist -> Request 'RW Gist +createGistR ngist = command Post ["gists"] (encode ngist) + -- | Star a gist by the authenticated user. -- See starGistR :: Name Gist -> GenRequest 'MtUnit 'RW () From 91424a994ab2a3c353e5356e065c341c3c638b83 Mon Sep 17 00:00:00 2001 From: MATSUBARA Nobutada Date: Fri, 1 Jan 2021 12:30:19 +0900 Subject: [PATCH 041/121] Refactor: remove brackets that are redundant --- src/GitHub/Data/Gists.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/GitHub/Data/Gists.hs b/src/GitHub/Data/Gists.hs index 04c98bae..b9402943 100644 --- a/src/GitHub/Data/Gists.hs +++ b/src/GitHub/Data/Gists.hs @@ -100,14 +100,14 @@ instance NFData NewGist where rnf = genericRnf instance Binary NewGist instance ToJSON NewGist where - toJSON (NewGist { newGistDescription = description - , newGistFiles = files - , newGistPublic = public - }) = object - [ "description" .= description - , "files" .= files - , "public" .= public - ] + toJSON NewGist { newGistDescription = description + , newGistFiles = files + , newGistPublic = public + } = object + [ "description" .= description + , "files" .= files + , "public" .= public + ] data NewGistFile = NewGistFile { newGistFileContent :: !Text From c44824bb6c41aad7fc9ac59e4686e138c9d67066 Mon Sep 17 00:00:00 2001 From: MATSUBARA Nobutada Date: Fri, 1 Jan 2021 15:10:37 +0900 Subject: [PATCH 042/121] Fix: use Maybe a for optional params with filter notNull --- src/GitHub/Data/Gists.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/GitHub/Data/Gists.hs b/src/GitHub/Data/Gists.hs index b9402943..b6d1b673 100644 --- a/src/GitHub/Data/Gists.hs +++ b/src/GitHub/Data/Gists.hs @@ -91,9 +91,9 @@ instance FromJSON GistComment where <*> o .: "id" data NewGist = NewGist - { newGistDescription :: !Text + { newGistDescription :: !(Maybe Text) , newGistFiles :: !(HashMap Text NewGistFile) - , newGistPublic :: !Bool + , newGistPublic :: !(Maybe Bool) } deriving (Show, Data, Typeable, Eq, Generic) instance NFData NewGist where rnf = genericRnf @@ -103,11 +103,14 @@ instance ToJSON NewGist where toJSON NewGist { newGistDescription = description , newGistFiles = files , newGistPublic = public - } = object + } = object $ filter notNull [ "description" .= description , "files" .= files , "public" .= public ] + where + notNull (_, Null) = False + notNull (_, _) = True data NewGistFile = NewGistFile { newGistFileContent :: !Text From bf5f8fd3828698b28f5c307af6cc21ffe9fffb5b Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sat, 6 Mar 2021 23:34:15 +0200 Subject: [PATCH 043/121] Allow base-4.15 --- .github/workflows/haskell-ci.yml | 47 +++++++++++++++++++++++--------- cabal.project | 4 +++ github.cabal | 9 +++--- samples/github-samples.cabal | 5 ++-- 4 files changed, 46 insertions(+), 19 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 2dd020d0..637021b1 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.11.20201213 +# version: 0.11.20210222 # -# REGENDATA ("0.11.20201213",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.11.20210222",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -22,21 +22,32 @@ on: - master jobs: linux: - name: Haskell-CI Linux + name: Haskell-CI - Linux - GHC ${{ matrix.ghc }} runs-on: ubuntu-18.04 container: image: buildpack-deps:bionic + continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: - - ghc: 8.10.1 - - ghc: 8.8.3 + - ghc: 9.0.1 + allow-failure: false + - ghc: 8.10.4 + allow-failure: false + - ghc: 8.8.4 + allow-failure: false - ghc: 8.6.5 + allow-failure: false - ghc: 8.4.4 + allow-failure: false - ghc: 8.2.2 + allow-failure: false - ghc: 8.0.2 + allow-failure: false - ghc: 7.10.3 + allow-failure: false - ghc: 7.8.4 + allow-failure: false fail-fast: false steps: - name: apt @@ -45,7 +56,7 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common apt-add-repository -y 'ppa:hvr/ghc' apt-get update - apt-get install -y ghc-$GHC_VERSION cabal-install-3.2 + apt-get install -y ghc-$GHC_VERSION cabal-install-3.4 env: GHC_VERSION: ${{ matrix.ghc }} - name: Set PATH and environment variables @@ -58,12 +69,13 @@ jobs: echo "HC=$HC" >> $GITHUB_ENV echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV - echo "CABAL=/opt/cabal/3.2/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV + echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV - echo "ARG_COMPILER=--ghc --with-compiler=/opt/ghc/$GHC_VERSION/bin/ghc" >> $GITHUB_ENV + echo "HEADHACKAGE=false" >> $GITHUB_ENV + echo "ARG_COMPILER=--ghc --with-compiler=$HC" >> $GITHUB_ENV echo "GHCJSARITH=0" >> $GITHUB_ENV env: GHC_VERSION: ${{ matrix.ghc }} @@ -75,7 +87,7 @@ jobs: mkdir -p $CABAL_DIR cat >> $CABAL_CONFIG < $HOME/.cabal/bin/cabal-plan rm -f cabal-plan.xz chmod a+x $HOME/.cabal/bin/cabal-plan + cabal-plan --version - name: checkout uses: actions/checkout@v2 with: path: source + - name: initial cabal.project for sdist + run: | + touch cabal.project + echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project + echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project + cat cabal.project - name: sdist run: | mkdir -p sdist - cd source || false $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist - name: unpack run: | @@ -138,6 +156,9 @@ jobs: constraints: semigroups ^>=0.19 constraints: github +openssl constraints: github-samples +openssl + allow-newer: deepseq-generics-0.2.0.0:base + allow-newer: deepseq-generics-0.2.0.0:ghc-prim + allow-newer: cryptohash-sha1-0.11.100.1:base optimization: False EOF $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local @@ -155,14 +176,14 @@ jobs: restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- - name: install dependencies run: | - $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only all - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only all + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all - name: build w/o tests run: | $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - name: build run: | - $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - name: tests run: | $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct diff --git a/cabal.project b/cabal.project index 555119f5..5e40418a 100644 --- a/cabal.project +++ b/cabal.project @@ -9,3 +9,7 @@ constraints: semigroups ^>=0.19 constraints: github +openssl constraints: github-samples +openssl + +allow-newer: deepseq-generics-0.2.0.0:base +allow-newer: deepseq-generics-0.2.0.0:ghc-prim +allow-newer: cryptohash-sha1-0.11.100.1:base diff --git a/github.cabal b/github.cabal index 1b4f2e40..348a9345 100644 --- a/github.cabal +++ b/github.cabal @@ -27,7 +27,7 @@ maintainer: Oleg Grenrus homepage: https://github.com/phadej/github build-type: Simple copyright: - Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2019 Oleg Grenrus + Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: GHC ==7.8.4 @@ -36,8 +36,9 @@ tested-with: || ==8.2.2 || ==8.4.4 || ==8.6.5 - || ==8.8.3 - || ==8.10.1 + || ==8.8.4 + || ==8.10.4 + || ==9.0.1 extra-source-files: README.md @@ -164,7 +165,7 @@ library -- Packages bundles with GHC, mtl and text are also here build-depends: - base >=4.7 && <4.15 + base >=4.7 && <4.16 , binary >=0.7.1.0 && <0.11 , bytestring >=0.10.4.0 && <0.11 , containers >=0.5.5.1 && <0.7 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 41d6dccf..270609d7 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -15,8 +15,9 @@ tested-with: || ==8.2.2 || ==8.4.4 || ==8.6.5 - || ==8.8.3 - || ==8.10.1 + || ==8.8.4 + || ==8.10.4 + || ==9.0.1 library hs-source-dirs: src From 492735656d6a8efa4bf0ec4ce4cca1855327d78c Mon Sep 17 00:00:00 2001 From: Gautier DI FOLCO Date: Mon, 13 Sep 2021 18:51:27 +0200 Subject: [PATCH 044/121] Update RepoWebhookEvent --- src/GitHub/Data/Webhooks.hs | 52 +++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/src/GitHub/Data/Webhooks.hs b/src/GitHub/Data/Webhooks.hs index fb81969d..8ca2fe8e 100644 --- a/src/GitHub/Data/Webhooks.hs +++ b/src/GitHub/Data/Webhooks.hs @@ -35,6 +35,7 @@ data RepoWebhookEvent = WebhookWildcardEvent | WebhookCheckRunEvent | WebhookCheckSuiteEvent + | WebhookCodeScanningAlert | WebhookCommitCommentEvent | WebhookContentReferenceEvent | WebhookCreateEvent @@ -42,12 +43,13 @@ data RepoWebhookEvent | WebhookDeployKeyEvent | WebhookDeploymentEvent | WebhookDeploymentStatusEvent + | WebhookDiscussion + | WebhookDiscussionComment | WebhookDownloadEvent | WebhookFollowEvent | WebhookForkEvent - | WebhookForkApplyEvent - | WebhookGitHubAppAuthorizationEvent | WebhookGistEvent + | WebhookGitHubAppAuthorizationEvent | WebhookGollumEvent | WebhookInstallationEvent | WebhookInstallationRepositoriesEvent @@ -59,8 +61,9 @@ data RepoWebhookEvent | WebhookMembershipEvent | WebhookMetaEvent | WebhookMilestoneEvent - | WebhookOrganizationEvent | WebhookOrgBlockEvent + | WebhookOrganizationEvent + | WebhookPackage | WebhookPageBuildEvent | WebhookPingEvent | WebhookProjectCardEvent @@ -68,20 +71,25 @@ data RepoWebhookEvent | WebhookProjectEvent | WebhookPublicEvent | WebhookPullRequestEvent - | WebhookPullRequestReviewEvent | WebhookPullRequestReviewCommentEvent + | WebhookPullRequestReviewEvent | WebhookPushEvent | WebhookRegistryPackageEvent | WebhookReleaseEvent + | WebhookRepositoryDispatch | WebhookRepositoryEvent | WebhookRepositoryImportEvent | WebhookRepositoryVulnerabilityAlertEvent + | WebhookSecretScanningAlert | WebhookSecurityAdvisoryEvent + | WebhookSponsorship | WebhookStarEvent | WebhookStatusEvent - | WebhookTeamEvent | WebhookTeamAddEvent + | WebhookTeamEvent | WebhookWatchEvent + | WebhookWorkflowDispatch + | WebhookWorkflowRun deriving (Show, Data, Typeable, Eq, Ord, Generic) instance NFData RepoWebhookEvent where rnf = genericRnf @@ -137,6 +145,7 @@ instance FromJSON RepoWebhookEvent where "*" -> pure WebhookWildcardEvent "check_run" -> pure WebhookCheckRunEvent "check_suite" -> pure WebhookCheckSuiteEvent + "code_scanning_alert" -> pure WebhookCodeScanningAlert "commit_comment" -> pure WebhookCommitCommentEvent "content_reference" -> pure WebhookContentReferenceEvent "create" -> pure WebhookCreateEvent @@ -144,12 +153,13 @@ instance FromJSON RepoWebhookEvent where "deploy_key" -> pure WebhookDeployKeyEvent "deployment" -> pure WebhookDeploymentEvent "deployment_status" -> pure WebhookDeploymentStatusEvent + "discussion" -> pure WebhookDiscussion + "discussion_comment" -> pure WebhookDiscussionComment "download" -> pure WebhookDownloadEvent "follow" -> pure WebhookFollowEvent "fork" -> pure WebhookForkEvent - "fork_apply" -> pure WebhookForkApplyEvent - "github_app_authorization" -> pure WebhookGitHubAppAuthorizationEvent "gist" -> pure WebhookGistEvent + "github_app_authorization" -> pure WebhookGitHubAppAuthorizationEvent "gollum" -> pure WebhookGollumEvent "installation" -> pure WebhookInstallationEvent "installation_repositories" -> pure WebhookInstallationRepositoriesEvent @@ -161,13 +171,14 @@ instance FromJSON RepoWebhookEvent where "membership" -> pure WebhookMembershipEvent "meta" -> pure WebhookMetaEvent "milestone" -> pure WebhookMilestoneEvent - "organization" -> pure WebhookOrganizationEvent "org_block" -> pure WebhookOrgBlockEvent + "organization" -> pure WebhookOrganizationEvent + "package" -> pure WebhookPackage "page_build" -> pure WebhookPageBuildEvent "ping" -> pure WebhookPingEvent + "project" -> pure WebhookProjectEvent "project_card" -> pure WebhookProjectCardEvent "project_column" -> pure WebhookProjectColumnEvent - "project" -> pure WebhookProjectEvent "public" -> pure WebhookPublicEvent "pull_request" -> pure WebhookPullRequestEvent "pull_request_review" -> pure WebhookPullRequestReviewEvent @@ -176,20 +187,26 @@ instance FromJSON RepoWebhookEvent where "registry_package" -> pure WebhookRegistryPackageEvent "release" -> pure WebhookReleaseEvent "repository" -> pure WebhookRepositoryEvent + "repository_dispatch" -> pure WebhookRepositoryDispatch "repository_import" -> pure WebhookRepositoryImportEvent "repository_vulnerability_alert" -> pure WebhookRepositoryVulnerabilityAlertEvent + "secret_scanning_alert" -> pure WebhookSecretScanningAlert "security_advisory" -> pure WebhookSecurityAdvisoryEvent + "sponsorship" -> pure WebhookSponsorship "star" -> pure WebhookStarEvent "status" -> pure WebhookStatusEvent "team" -> pure WebhookTeamEvent "team_add" -> pure WebhookTeamAddEvent "watch" -> pure WebhookWatchEvent + "workflow_dispatch" -> pure WebhookWorkflowDispatch + "workflow_run" -> pure WebhookWorkflowRun _ -> fail $ "Unknown RepoWebhookEvent: " <> T.unpack t instance ToJSON RepoWebhookEvent where toJSON WebhookWildcardEvent = String "*" toJSON WebhookCheckRunEvent = String "check_run" toJSON WebhookCheckSuiteEvent = String "check_suite" + toJSON WebhookCodeScanningAlert = String "code_scanning_alert" toJSON WebhookCommitCommentEvent = String "commit_comment" toJSON WebhookContentReferenceEvent = String "content_reference" toJSON WebhookCreateEvent = String "create" @@ -197,12 +214,13 @@ instance ToJSON RepoWebhookEvent where toJSON WebhookDeployKeyEvent = String "deploy_key" toJSON WebhookDeploymentEvent = String "deployment" toJSON WebhookDeploymentStatusEvent = String "deployment_status" + toJSON WebhookDiscussion = String "discussion" + toJSON WebhookDiscussionComment = String "discussion_comment" toJSON WebhookDownloadEvent = String "download" toJSON WebhookFollowEvent = String "follow" toJSON WebhookForkEvent = String "fork" - toJSON WebhookForkApplyEvent = String "fork_apply" - toJSON WebhookGitHubAppAuthorizationEvent = String "github_app_authorization" toJSON WebhookGistEvent = String "gist" + toJSON WebhookGitHubAppAuthorizationEvent = String "github_app_authorization" toJSON WebhookGollumEvent = String "gollum" toJSON WebhookInstallationEvent = String "installation" toJSON WebhookInstallationRepositoriesEvent = String "installation_repositories" @@ -214,8 +232,9 @@ instance ToJSON RepoWebhookEvent where toJSON WebhookMembershipEvent = String "membership" toJSON WebhookMetaEvent = String "meta" toJSON WebhookMilestoneEvent = String "milestone" - toJSON WebhookOrganizationEvent = String "organization" toJSON WebhookOrgBlockEvent = String "org_block" + toJSON WebhookOrganizationEvent = String "organization" + toJSON WebhookPackage = String "package" toJSON WebhookPageBuildEvent = String "page_build" toJSON WebhookPingEvent = String "ping" toJSON WebhookProjectCardEvent = String "project_card" @@ -223,20 +242,25 @@ instance ToJSON RepoWebhookEvent where toJSON WebhookProjectEvent = String "project" toJSON WebhookPublicEvent = String "public" toJSON WebhookPullRequestEvent = String "pull_request" - toJSON WebhookPullRequestReviewEvent = String "pull_request_review" toJSON WebhookPullRequestReviewCommentEvent = String "pull_request_review_comment" + toJSON WebhookPullRequestReviewEvent = String "pull_request_review" toJSON WebhookPushEvent = String "push" toJSON WebhookRegistryPackageEvent = String "registry_package" toJSON WebhookReleaseEvent = String "release" + toJSON WebhookRepositoryDispatch = String "repository_dispatch" toJSON WebhookRepositoryEvent = String "repository" toJSON WebhookRepositoryImportEvent = String "repository_import" toJSON WebhookRepositoryVulnerabilityAlertEvent = String "repository_vulnerability_alert" + toJSON WebhookSecretScanningAlert = String "secret_scanning_alert" toJSON WebhookSecurityAdvisoryEvent = String "security_advisory" + toJSON WebhookSponsorship = String "sponsorship" toJSON WebhookStarEvent = String "star" toJSON WebhookStatusEvent = String "status" - toJSON WebhookTeamEvent = String "team" toJSON WebhookTeamAddEvent = String "team_add" + toJSON WebhookTeamEvent = String "team" toJSON WebhookWatchEvent = String "watch" + toJSON WebhookWorkflowDispatch = String "workflow_dispatch" + toJSON WebhookWorkflowRun = String "workflow_run" instance FromJSON RepoWebhook where parseJSON = withObject "RepoWebhook" $ \o -> RepoWebhook From 2d3bd03f72e5640ff9a7708d3ef35890dbdce998 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 10 Oct 2021 00:27:27 +0300 Subject: [PATCH 045/121] Regenerate CI --- .github/workflows/haskell-ci.yml | 101 ++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 34 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 637021b1..f70f1749 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.11.20210222 +# version: 0.13.20210827 # -# REGENDATA ("0.11.20210222",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.13.20210827",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -22,7 +22,7 @@ on: - master jobs: linux: - name: Haskell-CI - Linux - GHC ${{ matrix.ghc }} + name: Haskell-CI - Linux - ${{ matrix.compiler }} runs-on: ubuntu-18.04 container: image: buildpack-deps:bionic @@ -30,55 +30,87 @@ jobs: strategy: matrix: include: - - ghc: 9.0.1 + - compiler: ghc-9.0.1 + compilerKind: ghc + compilerVersion: 9.0.1 + setup-method: hvr-ppa allow-failure: false - - ghc: 8.10.4 + - compiler: ghc-8.10.4 + compilerKind: ghc + compilerVersion: 8.10.4 + setup-method: hvr-ppa allow-failure: false - - ghc: 8.8.4 + - compiler: ghc-8.8.4 + compilerKind: ghc + compilerVersion: 8.8.4 + setup-method: hvr-ppa allow-failure: false - - ghc: 8.6.5 + - compiler: ghc-8.6.5 + compilerKind: ghc + compilerVersion: 8.6.5 + setup-method: hvr-ppa allow-failure: false - - ghc: 8.4.4 + - compiler: ghc-8.4.4 + compilerKind: ghc + compilerVersion: 8.4.4 + setup-method: hvr-ppa allow-failure: false - - ghc: 8.2.2 + - compiler: ghc-8.2.2 + compilerKind: ghc + compilerVersion: 8.2.2 + setup-method: hvr-ppa allow-failure: false - - ghc: 8.0.2 + - compiler: ghc-8.0.2 + compilerKind: ghc + compilerVersion: 8.0.2 + setup-method: hvr-ppa allow-failure: false - - ghc: 7.10.3 + - compiler: ghc-7.10.3 + compilerKind: ghc + compilerVersion: 7.10.3 + setup-method: hvr-ppa allow-failure: false - - ghc: 7.8.4 + - compiler: ghc-7.8.4 + compilerKind: ghc + compilerVersion: 7.8.4 + setup-method: hvr-ppa allow-failure: false fail-fast: false steps: - name: apt run: | apt-get update - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 apt-add-repository -y 'ppa:hvr/ghc' apt-get update - apt-get install -y ghc-$GHC_VERSION cabal-install-3.4 + apt-get install -y "$HCNAME" cabal-install-3.4 env: - GHC_VERSION: ${{ matrix.ghc }} + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} - name: Set PATH and environment variables run: | echo "$HOME/.cabal/bin" >> $GITHUB_PATH - echo "LANG=C.UTF-8" >> $GITHUB_ENV - echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV - echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV - HC=/opt/ghc/$GHC_VERSION/bin/ghc - echo "HC=$HC" >> $GITHUB_ENV - echo "HCPKG=/opt/ghc/$GHC_VERSION/bin/ghc-pkg" >> $GITHUB_ENV - echo "HADDOCK=/opt/ghc/$GHC_VERSION/bin/haddock" >> $GITHUB_ENV - echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" + echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" + echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" + HCDIR=/opt/$HCKIND/$HCVER + HC=$HCDIR/bin/$HCKIND + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" + echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" + echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') - echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV - echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV - echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV - echo "HEADHACKAGE=false" >> $GITHUB_ENV - echo "ARG_COMPILER=--ghc --with-compiler=$HC" >> $GITHUB_ENV - echo "GHCJSARITH=0" >> $GITHUB_ENV + echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" + echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" + echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" + echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: - GHC_VERSION: ${{ matrix.ghc }} + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} - name: env run: | env @@ -140,9 +172,10 @@ jobs: - name: generate cabal.project run: | PKGDIR_github="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/github-[0-9.]*')" - echo "PKGDIR_github=${PKGDIR_github}" >> $GITHUB_ENV + echo "PKGDIR_github=${PKGDIR_github}" >> "$GITHUB_ENV" PKGDIR_github_samples="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/github-samples-[0-9.]*')" - echo "PKGDIR_github_samples=${PKGDIR_github_samples}" >> $GITHUB_ENV + echo "PKGDIR_github_samples=${PKGDIR_github_samples}" >> "$GITHUB_ENV" + rm -f cabal.project cabal.project.local touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_github}" >> cabal.project @@ -171,9 +204,9 @@ jobs: - name: cache uses: actions/cache@v2 with: - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store - restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- - name: install dependencies run: | $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all From a9656e92a8312e08df9a5f0000e6d1c8bd32d4fa Mon Sep 17 00:00:00 2001 From: sanjiv sahayam Date: Mon, 3 Aug 2020 09:28:54 +1000 Subject: [PATCH 046/121] Fix decoding of optional submitted_at field in review --- fixtures/pull-request-approved-review.json | 38 ++++++++++++++++++++++ fixtures/pull-request-pending-review.json | 37 +++++++++++++++++++++ github.cabal | 1 + spec/GitHub/ReviewDecodeSpec.hs | 25 ++++++++++++++ src/GitHub/Data/Reviews.hs | 12 +++---- 5 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 fixtures/pull-request-approved-review.json create mode 100644 fixtures/pull-request-pending-review.json create mode 100644 spec/GitHub/ReviewDecodeSpec.hs diff --git a/fixtures/pull-request-approved-review.json b/fixtures/pull-request-approved-review.json new file mode 100644 index 00000000..d675f9af --- /dev/null +++ b/fixtures/pull-request-approved-review.json @@ -0,0 +1,38 @@ +{ + "id": 80, + "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", + "user": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "body": "Here is the body for the review.", + "state": "APPROVED", + "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", + "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", + "_links": { + "html": { + "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" + }, + "pull_request": { + "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" + } + }, + "submitted_at": "2019-11-17T17:43:43Z", + "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091" +} \ No newline at end of file diff --git a/fixtures/pull-request-pending-review.json b/fixtures/pull-request-pending-review.json new file mode 100644 index 00000000..bea632a7 --- /dev/null +++ b/fixtures/pull-request-pending-review.json @@ -0,0 +1,37 @@ +{ + "id": 80, + "node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=", + "user": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "body": "Here is the body for the review.", + "state": "PENDING", + "html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80", + "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12", + "_links": { + "html": { + "href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" + }, + "pull_request": { + "href": "https://api.github.com/repos/octocat/Hello-World/pulls/12" + } + }, + "commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091" +} \ No newline at end of file diff --git a/github.cabal b/github.cabal index 3d2cd03b..8b24a863 100644 --- a/github.cabal +++ b/github.cabal @@ -223,6 +223,7 @@ test-suite github-test GitHub.RateLimitSpec GitHub.ReleasesSpec GitHub.ReposSpec + GitHub.ReviewDecodeSpec GitHub.SearchSpec GitHub.UsersSpec diff --git a/spec/GitHub/ReviewDecodeSpec.hs b/spec/GitHub/ReviewDecodeSpec.hs new file mode 100644 index 00000000..76060513 --- /dev/null +++ b/spec/GitHub/ReviewDecodeSpec.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.ReviewDecodeSpec where + +import Data.Aeson (eitherDecodeStrict) +import Data.Either.Compat (isRight) +import Data.FileEmbed (embedFile) +import Test.Hspec + (Spec, describe, it, shouldSatisfy) + +import GitHub.Data (Review) + +spec :: Spec +spec = do + describe "PENDING state" $ do + -- https://docs.github.com/en/rest/reference/pulls#create-a-review-for-a-pull-request + -- > Pull request reviews created in the PENDING state do not include the submitted_at property in the response. + it "decodes review when submitted_at is missing" $ do + let reviewInfo = eitherDecodeStrict $(embedFile "fixtures/pull-request-pending-review.json") :: Either String Review + reviewInfo `shouldSatisfy` isRight + + describe "Other states" $ do + it "decodes review" $ do + let reviewInfo = eitherDecodeStrict $(embedFile "fixtures/pull-request-approved-review.json") :: Either String Review + reviewInfo `shouldSatisfy` isRight diff --git a/src/GitHub/Data/Reviews.hs b/src/GitHub/Data/Reviews.hs index 27278437..72c6f6be 100644 --- a/src/GitHub/Data/Reviews.hs +++ b/src/GitHub/Data/Reviews.hs @@ -35,7 +35,7 @@ data Review = Review { reviewBody :: !Text , reviewCommitId :: !Text , reviewState :: ReviewState - , reviewSubmittedAt :: !UTCTime + , reviewSubmittedAt :: !(Maybe UTCTime) , reviewPullRequestUrl :: !URL , reviewHtmlUrl :: !Text , reviewUser :: !SimpleUser @@ -51,11 +51,11 @@ instance FromJSON Review where parseJSON = withObject "Review" $ \o -> Review <$> o .: "body" <*> o .: "commit_id" <*> o .: "state" <*> - o .: "submitted_at" <*> - o .: "pull_request_url" <*> - o .: "html_url" <*> - o .: "user" <*> - o .: "id" + o .:? "submitted_at" <*> + o .: "pull_request_url" <*> + o .: "html_url" <*> + o .: "user" <*> + o .: "id" data ReviewComment = ReviewComment { reviewCommentId :: !(Id ReviewComment) From dd3dfbccaf4de4c3095b52fefb52c6b3c961a8f8 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 10 Oct 2021 00:28:23 +0300 Subject: [PATCH 047/121] Support aeson-2.0, and more bound relaxations --- .github/workflows/haskell-ci.yml | 1 + cabal.project | 1 + github.cabal | 6 +++--- src/GitHub/Data/Content.hs | 9 +++++++++ src/GitHub/Internal/Prelude.hs | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index f70f1749..7bddbf8e 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -192,6 +192,7 @@ jobs: allow-newer: deepseq-generics-0.2.0.0:base allow-newer: deepseq-generics-0.2.0.0:ghc-prim allow-newer: cryptohash-sha1-0.11.100.1:base + allow-newer: http-link-header-1.2.0:attoparsec optimization: False EOF $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local diff --git a/cabal.project b/cabal.project index 5e40418a..0f0cd647 100644 --- a/cabal.project +++ b/cabal.project @@ -13,3 +13,4 @@ constraints: github-samples +openssl allow-newer: deepseq-generics-0.2.0.0:base allow-newer: deepseq-generics-0.2.0.0:ghc-prim allow-newer: cryptohash-sha1-0.11.100.1:base +allow-newer: http-link-header-1.2.0:attoparsec diff --git a/github.cabal b/github.cabal index 3d2cd03b..bf5dd3ba 100644 --- a/github.cabal +++ b/github.cabal @@ -170,8 +170,8 @@ library -- other packages build-depends: - aeson >=1.4.0.0 && <1.6 - , base-compat >=0.11.1 && <0.12 + aeson >=1.4.0.0 && <1.6 || >=2.0.1.0 && <2.1 + , base-compat >=0.11.1 && <0.13 , base16-bytestring >=0.1.1.6 && <1.1 , binary-instances >=1 && <1.1 , cryptohash-sha1 >=0.11.100.1 && <0.12 @@ -184,7 +184,7 @@ library , iso8601-time >=0.1.5 && <0.2 , network-uri >=2.6.1.0 && <2.7 , tagged >=0.8.5 && <0.9 - , transformers-compat >=0.6.5 && <0.7 + , transformers-compat >=0.6.5 && <0.8 , unordered-containers >=0.2.10.0 && <0.3 , vector >=0.12.0.1 && <0.13 , vector-instances >=3.4 && <3.5 diff --git a/src/GitHub/Data/Content.hs b/src/GitHub/Data/Content.hs index 5461ffa0..5580c866 100644 --- a/src/GitHub/Data/Content.hs +++ b/src/GitHub/Data/Content.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- License : BSD-3-Clause @@ -15,6 +16,10 @@ import Data.Aeson.Types (Pair) import Data.Maybe (maybe) import qualified Data.Text as T +#if MIN_VERSION_aeson(2,0,0) +import Data.Aeson (Key) +#endif + data Content = ContentFile !ContentFileData | ContentDirectory !(Vector ContentItem) @@ -205,5 +210,9 @@ instance ToJSON DeleteFile where ++ "author" .=? deleteFileAuthor ++ "committer" .=? deleteFileCommitter +#if MIN_VERSION_aeson(2,0,0) +(.=?) :: ToJSON v => Key -> Maybe v -> [Pair] +#else (.=?) :: ToJSON v => Text -> Maybe v -> [Pair] +#endif name .=? value = maybe [] (pure . (name .=)) value diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index 8c4785c3..2ac8633c 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -1,4 +1,5 @@ {-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- License : BSD-3-Clause From 25682961a30c6c18869cf00c24c2a44f232d0873 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 10 Oct 2021 17:54:20 +0300 Subject: [PATCH 048/121] Prepare 0.27 --- CHANGELOG.md | 11 +++++++++++ github.cabal | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 991d24c7..eddba7a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## Changes for 0.27 + +- Add vector of SimpleTeam in "requested_teams" field of PullRequest + [#453](https://github.com/phadej/github/pull/453) +- Add endpoint to create gist + [#455](https://github.com/phadej/github/pull/455) +- Update RepoWebhookEvent + [#461](https://github.com/phadej/github/pull/461) +- PullRequest Reviews may not have submitted_at field + [#450](https://github.com/phadej/github/pull/450) + ## Changes for 0.26 - Generalize PagedQuery to allow its reuse by preview github APIs diff --git a/github.cabal b/github.cabal index e3edf30a..c25f94f3 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: github -version: 0.26 +version: 0.27 synopsis: Access to the GitHub API, v3. category: Network description: From 9df0ad57644a8af9de15e222da233e5e2eba8c61 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sat, 13 Nov 2021 20:25:31 +0200 Subject: [PATCH 049/121] Allow base-4.16, hashable-1.4, bytestring-0.11 --- .github/workflows/haskell-ci.yml | 63 ++++++++++++++++++++++++-------- cabal.project | 5 +-- github.cabal | 14 ++++--- samples/github-samples.cabal | 3 +- 4 files changed, 59 insertions(+), 26 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 7bddbf8e..463233e7 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.13.20210827 +# version: 0.13.20211111 # -# REGENDATA ("0.13.20210827",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.13.20211111",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -24,21 +24,28 @@ jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} runs-on: ubuntu-18.04 + timeout-minutes: + 60 container: image: buildpack-deps:bionic continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: + - compiler: ghc-9.2.1 + compilerKind: ghc + compilerVersion: 9.2.1 + setup-method: ghcup + allow-failure: false - compiler: ghc-9.0.1 compilerKind: ghc compilerVersion: 9.0.1 setup-method: hvr-ppa allow-failure: false - - compiler: ghc-8.10.4 + - compiler: ghc-8.10.7 compilerKind: ghc - compilerVersion: 8.10.4 - setup-method: hvr-ppa + compilerVersion: 8.10.7 + setup-method: ghcup allow-failure: false - compiler: ghc-8.8.4 compilerKind: ghc @@ -81,9 +88,21 @@ jobs: run: | apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 - apt-add-repository -y 'ppa:hvr/ghc' - apt-get update - apt-get install -y "$HCNAME" cabal-install-3.4 + if [ "${{ matrix.setup-method }}" = ghcup ]; then + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 + else + apt-add-repository -y 'ppa:hvr/ghc' + apt-get update + apt-get install -y "$HCNAME" + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 + fi env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -95,11 +114,20 @@ jobs: echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER - HC=$HCDIR/bin/$HCKIND - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" - echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> "$GITHUB_ENV" + if [ "${{ matrix.setup-method }}" = ghcup ]; then + HC=$HOME/.ghcup/bin/$HCKIND-$HCVER + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" + echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + else + HC=$HCDIR/bin/$HCKIND + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" + echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + fi + HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" @@ -133,6 +161,10 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + cat >> $CABAL_CONFIG <= 80200)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <=1.3 + constraints: hashable >=1.3 constraints: semigroups ^>=0.19 constraints: github +openssl constraints: github-samples +openssl allow-newer: deepseq-generics-0.2.0.0:base allow-newer: deepseq-generics-0.2.0.0:ghc-prim - allow-newer: cryptohash-sha1-0.11.100.1:base - allow-newer: http-link-header-1.2.0:attoparsec + allow-newer: HsOpenSSL:bytestring optimization: False EOF $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local diff --git a/cabal.project b/cabal.project index 0f0cd647..b9ac7eb6 100644 --- a/cabal.project +++ b/cabal.project @@ -4,7 +4,7 @@ packages: samples optimization: False tests: True -constraints: hashable ^>=1.3 +constraints: hashable >=1.3 constraints: semigroups ^>=0.19 constraints: github +openssl @@ -12,5 +12,4 @@ constraints: github-samples +openssl allow-newer: deepseq-generics-0.2.0.0:base allow-newer: deepseq-generics-0.2.0.0:ghc-prim -allow-newer: cryptohash-sha1-0.11.100.1:base -allow-newer: http-link-header-1.2.0:attoparsec +allow-newer: HsOpenSSL:bytestring diff --git a/github.cabal b/github.cabal index c25f94f3..e9f0b5bf 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,7 @@ cabal-version: >=1.10 name: github version: 0.27 +x-revision: 1 synopsis: Access to the GitHub API, v3. category: Network description: @@ -37,8 +38,9 @@ tested-with: || ==8.4.4 || ==8.6.5 || ==8.8.4 - || ==8.10.4 + || ==8.10.7 || ==9.0.1 + || ==9.2.1 extra-source-files: README.md @@ -158,9 +160,9 @@ library -- Packages bundles with GHC, mtl and text are also here build-depends: - base >=4.7 && <4.16 + base >=4.7 && <4.17 , binary >=0.7.1.0 && <0.11 - , bytestring >=0.10.4.0 && <0.11 + , bytestring >=0.10.4.0 && <0.12 , containers >=0.5.5.1 && <0.7 , deepseq >=1.3.0.2 && <1.5 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.3 @@ -177,7 +179,7 @@ library , cryptohash-sha1 >=0.11.100.1 && <0.12 , deepseq-generics >=0.2.0.0 && <0.3 , exceptions >=0.10.2 && <0.11 - , hashable >=1.2.7.0 && <1.4 + , hashable >=1.2.7.0 && <1.5 , http-client >=0.5.12 && <0.8 , http-link-header >=1.0.3.1 && <1.3 , http-types >=0.12.3 && <0.13 @@ -209,7 +211,7 @@ test-suite github-test hs-source-dirs: spec main-is: Spec.hs ghc-options: -Wall -threaded - build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.8 + build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.10 other-extensions: TemplateHaskell other-modules: GitHub.ActivitySpec @@ -234,7 +236,7 @@ test-suite github-test , bytestring , file-embed , github - , hspec >=2.6.1 && <2.8 + , hspec >=2.6.1 && <2.10 , tagged , text , unordered-containers diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 270609d7..f1ff2045 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -16,8 +16,9 @@ tested-with: || ==8.4.4 || ==8.6.5 || ==8.8.4 - || ==8.10.4 + || ==8.10.7 || ==9.0.1 + || ==9.2.1 library hs-source-dirs: src From 558ab0d73d93837c0c53c75df4a1cc439884ff54 Mon Sep 17 00:00:00 2001 From: snxx-lppxx Date: Sat, 18 Dec 2021 19:54:02 +0500 Subject: [PATCH 050/121] readme: fix company name --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d6996412..f808c2a8 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -Github +GitHub ------ [![Build Status](https://travis-ci.org/phadej/github.svg?branch=master)](https://travis-ci.org/phadej/github) [![Hackage](https://img.shields.io/hackage/v/github.svg)][hackage] -The Github API v3 for Haskell. +The GitHub API v3 for Haskell. -Some functions are missing; these are functions where the Github API did -not work as expected. The full Github API is in beta and constantly +Some functions are missing; these are functions where the GitHub API did +not work as expected. The full GitHub API is in beta and constantly improving. Installation From 4184b466b968ad25d7e1e38c08ec9315ed1ce145 Mon Sep 17 00:00:00 2001 From: snxx-lppxx Date: Sat, 18 Dec 2021 21:13:01 +0500 Subject: [PATCH 051/121] addition #471 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f808c2a8..0a27ff91 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Documentation For details see the reference [documentation on Hackage][hackage]. Each module lines up with the hierarchy of -[documentation from the Github API](http://developer.github.com/v3/). +[documentation from the GitHub API](http://developer.github.com/v3/). Request functions (ending with `R`) construct a data type which can be executed in `IO` by `executeRequest` functions. They are all listed in the root `GitHub` From ec59ef8c683a8f2fa5a91efaf78ff8154420716c Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 8 Dec 2021 22:36:18 +0100 Subject: [PATCH 052/121] Silence compilation warnings for github library - remove unused imports - disable star-is-type warning while we are supporting GHC 7 --- github.cabal | 8 +++++++- src/GitHub/Data/Content.hs | 1 - src/GitHub/Data/Deployments.hs | 3 --- src/GitHub/Data/Reviews.hs | 1 - src/GitHub/Endpoints/PullRequests/Reviews.hs | 1 - src/GitHub/Endpoints/Repos/Deployments.hs | 2 -- src/GitHub/Request.hs | 3 +-- 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/github.cabal b/github.cabal index e9f0b5bf..c2da752b 100644 --- a/github.cabal +++ b/github.cabal @@ -58,7 +58,13 @@ flag openssl library default-language: Haskell2010 - ghc-options: -Wall + ghc-options: + -Wall + if impl(ghc >= 8.0) + ghc-options: + -Wcompat + -Wno-star-is-type + -- The star-is-type warning cannot be sensiblity addressed while supporting GHC 7. hs-source-dirs: src default-extensions: DataKinds diff --git a/src/GitHub/Data/Content.hs b/src/GitHub/Data/Content.hs index 5580c866..7a4dca9b 100644 --- a/src/GitHub/Data/Content.hs +++ b/src/GitHub/Data/Content.hs @@ -13,7 +13,6 @@ import GitHub.Internal.Prelude import Prelude () import Data.Aeson.Types (Pair) -import Data.Maybe (maybe) import qualified Data.Text as T #if MIN_VERSION_aeson(2,0,0) diff --git a/src/GitHub/Data/Deployments.hs b/src/GitHub/Data/Deployments.hs index face7a52..e14a214e 100644 --- a/src/GitHub/Data/Deployments.hs +++ b/src/GitHub/Data/Deployments.hs @@ -19,9 +19,6 @@ import Prelude () import Control.Arrow (second) import Data.ByteString (ByteString) -import Data.Maybe (catMaybes) -import Data.Text (Text) -import Data.Vector (Vector) import GitHub.Data.Definitions (SimpleUser) import GitHub.Data.Id (Id) diff --git a/src/GitHub/Data/Reviews.hs b/src/GitHub/Data/Reviews.hs index 72c6f6be..b00edb74 100644 --- a/src/GitHub/Data/Reviews.hs +++ b/src/GitHub/Data/Reviews.hs @@ -6,7 +6,6 @@ import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () -import Data.Text (Text) import qualified Data.Text as T data ReviewState diff --git a/src/GitHub/Endpoints/PullRequests/Reviews.hs b/src/GitHub/Endpoints/PullRequests/Reviews.hs index e5c42ac8..fe95d25b 100644 --- a/src/GitHub/Endpoints/PullRequests/Reviews.hs +++ b/src/GitHub/Endpoints/PullRequests/Reviews.hs @@ -12,7 +12,6 @@ module GitHub.Endpoints.PullRequests.Reviews ) where import GitHub.Data -import GitHub.Data.Id (Id) import GitHub.Internal.Prelude import Prelude () diff --git a/src/GitHub/Endpoints/Repos/Deployments.hs b/src/GitHub/Endpoints/Repos/Deployments.hs index ed94c16a..39724771 100644 --- a/src/GitHub/Endpoints/Repos/Deployments.hs +++ b/src/GitHub/Endpoints/Repos/Deployments.hs @@ -11,8 +11,6 @@ module GitHub.Endpoints.Repos.Deployments import Control.Arrow (second) -import Data.Vector (Vector) - import GitHub.Data import GitHub.Internal.Prelude diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index 808f33a7..2481deea 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -80,8 +80,7 @@ import Control.Monad.Catch (MonadCatch (..), MonadThrow) import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Except (ExceptT (..), runExceptT) import Data.Aeson (eitherDecode) -import Data.List (find, intercalate) -import Data.String (fromString) +import Data.List (find) import Data.Tagged (Tagged (..)) import Data.Version (showVersion) From abc27cab9af8769eed34242d1f0a2718d05d15b1 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 8 Dec 2021 22:54:49 +0100 Subject: [PATCH 053/121] Complete API for repo-issues Add missing methods to set the following fields of 'IssueRepoOptions': - specific milestone - specific assignee - creator - mentioned --- github.cabal | 3 +- src/GitHub/Data/Options.hs | 107 ++++++++++++++++++++++++++++++++----- 2 files changed, 96 insertions(+), 14 deletions(-) diff --git a/github.cabal b/github.cabal index c2da752b..2d90197f 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,6 @@ cabal-version: >=1.10 name: github -version: 0.27 -x-revision: 1 +version: 0.28 synopsis: Access to the GitHub API, v3. category: Network description: diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 70665317..c861c212 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -38,12 +38,16 @@ module GitHub.Data.Options ( -- * Repo issues IssueRepoMod, issueRepoModToQueryString, + optionsCreator, + optionsMentioned, optionsIrrelevantMilestone, optionsAnyMilestone, optionsNoMilestone, + optionsMilestone, optionsIrrelevantAssignee, optionsAnyAssignee, optionsNoAssignee, + optionsAssignee, -- * Data IssueState (..), MergeableState (..), @@ -351,7 +355,7 @@ sortByLongRunning = PRMod $ \opts -> -- Issues ------------------------------------------------------------------------------- --- | See . +-- | See . data IssueOptions = IssueOptions { issueOptionsFilter :: !IssueFilter , issueOptionsState :: !(Maybe IssueState) @@ -373,7 +377,7 @@ defaultIssueOptions = IssueOptions , issueOptionsSince = Nothing } --- | See . +-- | See . newtype IssueMod = IssueMod (IssueOptions -> IssueOptions) instance Semigroup IssueMod where @@ -491,16 +495,70 @@ issueFilter f = IssueMod $ \opts -> -- Issues repo ------------------------------------------------------------------------------- +-- | See . +-- Retrieved: 2021-12-08 +-- +-- Parameters of "list repository issues" (@get /repos/{owner}/{repo}/issues@) +-- +-- * milestone : string +-- +-- If an integer is passed, it should refer to a milestone by its number field. If the string * is passed, issues with any milestone are accepted. If the string none is passed, issues without milestones are returned. +-- +-- * state : string +-- +-- Indicates the state of the issues to return. Can be either open, closed, or all. +-- Default: open +-- +-- * assignee : string +-- +-- Can be the name of a user. Pass in none for issues with no assigned user, and * for issues assigned to any user. +-- +-- * creator : string +-- +-- The user that created the issue. +-- +-- * mentioned : string +-- +-- A user that's mentioned in the issue. +-- +-- * labels : string +-- +-- A list of comma separated label names. Example: bug,ui,@high +-- +-- * sort : string +-- +-- What to sort results by. Can be either created, updated, comments. +-- Default: created +-- +-- * direction : string +-- +-- One of asc (ascending) or desc (descending). +-- Default: desc +-- +-- * since : string +-- +-- Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. +-- +-- * per_page : integer +-- +-- Results per page (max 100) +-- Default: 30 +-- +-- * page : integer +-- +-- Page number of the results to fetch. +-- Default: 1 +-- data IssueRepoOptions = IssueRepoOptions - { issueRepoOptionsMilestone :: !(FilterBy (Id Milestone)) - , issueRepoOptionsState :: !(Maybe IssueState) - , issueRepoOptionsAssignee :: !(FilterBy (Name User)) - , issueRepoOptionsCreator :: !(Maybe (Name User)) - , issueRepoOptionsMentioned :: !(Maybe (Name User)) - , issueRepoOptionsLabels :: ![Name IssueLabel] - , issueRepoOptionsSort :: !SortIssue - , issueRepoOptionsDirection :: !SortDirection - , issueRepoOptionsSince :: !(Maybe UTCTime) + { issueRepoOptionsMilestone :: !(FilterBy (Id Milestone)) -- ^ 'optionsMilestone' etc. + , issueRepoOptionsState :: !(Maybe IssueState) -- ^ 'HasState' + , issueRepoOptionsAssignee :: !(FilterBy (Name User)) -- ^ 'optionsAssignee' etc. + , issueRepoOptionsCreator :: !(Maybe (Name User)) -- ^ 'optionsCreator' + , issueRepoOptionsMentioned :: !(Maybe (Name User)) -- ^ 'optionsMentioned' + , issueRepoOptionsLabels :: ![Name IssueLabel] -- ^ 'HasLabels' + , issueRepoOptionsSort :: !SortIssue -- ^ 'HasCreatedUpdated' and 'HasComments' + , issueRepoOptionsDirection :: !SortDirection -- ^ 'HasDirection' + , issueRepoOptionsSince :: !(Maybe UTCTime) -- ^ 'HasSince' } deriving (Eq, Ord, Show, Generic, Typeable, Data) @@ -579,7 +637,17 @@ issueRepoOptionsToQueryString IssueRepoOptions {..} = -- Issues repo modifiers ------------------------------------------------------------------------------- --- | Don't care about milestones. +-- | Issues created by a certain user. +optionsCreator :: Name User -> IssueRepoMod +optionsCreator u = IssueRepoMod $ \opts -> + opts { issueRepoOptionsCreator = Just u } + +-- | Issue mentioning the given user. +optionsMentioned :: Name User -> IssueRepoMod +optionsMentioned u = IssueRepoMod $ \opts -> + opts { issueRepoOptionsMentioned = Just u } + +-- | Don't care about milestones (default). -- -- 'optionsAnyMilestone' means there should be some milestone, but it can be any. -- @@ -588,22 +656,37 @@ optionsIrrelevantMilestone :: IssueRepoMod optionsIrrelevantMilestone = IssueRepoMod $ \opts -> opts { issueRepoOptionsMilestone = FilterNotSpecified } +-- | Issues that have a milestone. optionsAnyMilestone :: IssueRepoMod optionsAnyMilestone = IssueRepoMod $ \opts -> opts { issueRepoOptionsMilestone = FilterAny } +-- | Issues that have no milestone. optionsNoMilestone :: IssueRepoMod optionsNoMilestone = IssueRepoMod $ \opts -> opts { issueRepoOptionsMilestone = FilterNone } +-- | Issues with the given milestone. +optionsMilestone :: Id Milestone -> IssueRepoMod +optionsMilestone m = IssueRepoMod $ \opts -> + opts { issueRepoOptionsMilestone = FilterBy m } + +-- | Issues with or without assignee (default). optionsIrrelevantAssignee :: IssueRepoMod optionsIrrelevantAssignee = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterNotSpecified } +-- | Issues assigned to someone. optionsAnyAssignee :: IssueRepoMod optionsAnyAssignee = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterAny } +-- | Issues assigned to nobody. optionsNoAssignee :: IssueRepoMod optionsNoAssignee = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterNone } + +-- | Issues assigned to a specific user. +optionsAssignee :: Name User -> IssueRepoMod +optionsAssignee u = IssueRepoMod $ \opts -> + opts { issueRepoOptionsAssignee = FilterBy u } From 3a26d2f17d345c0cd706b8fbe869d6fdd0528af5 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 21 Dec 2021 15:12:18 +0100 Subject: [PATCH 054/121] PR #470: no major version bump, remove clone of GitHub API docs --- github.cabal | 2 +- src/GitHub/Data/Options.hs | 54 ++------------------------------------ 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/github.cabal b/github.cabal index 2d90197f..be54e398 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: github -version: 0.28 +version: 0.27.1 synopsis: Access to the GitHub API, v3. category: Network description: diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index c861c212..24bc4369 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -495,59 +495,9 @@ issueFilter f = IssueMod $ \opts -> -- Issues repo ------------------------------------------------------------------------------- --- | See . --- Retrieved: 2021-12-08 +-- | Parameters of "list repository issues" (@get /repos/{owner}/{repo}/issues@). -- --- Parameters of "list repository issues" (@get /repos/{owner}/{repo}/issues@) --- --- * milestone : string --- --- If an integer is passed, it should refer to a milestone by its number field. If the string * is passed, issues with any milestone are accepted. If the string none is passed, issues without milestones are returned. --- --- * state : string --- --- Indicates the state of the issues to return. Can be either open, closed, or all. --- Default: open --- --- * assignee : string --- --- Can be the name of a user. Pass in none for issues with no assigned user, and * for issues assigned to any user. --- --- * creator : string --- --- The user that created the issue. --- --- * mentioned : string --- --- A user that's mentioned in the issue. --- --- * labels : string --- --- A list of comma separated label names. Example: bug,ui,@high --- --- * sort : string --- --- What to sort results by. Can be either created, updated, comments. --- Default: created --- --- * direction : string --- --- One of asc (ascending) or desc (descending). --- Default: desc --- --- * since : string --- --- Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. --- --- * per_page : integer --- --- Results per page (max 100) --- Default: 30 --- --- * page : integer --- --- Page number of the results to fetch. --- Default: 1 +-- See . -- data IssueRepoOptions = IssueRepoOptions { issueRepoOptionsMilestone :: !(FilterBy (Id Milestone)) -- ^ 'optionsMilestone' etc. From 16d5350a57a5b9917dac7ee42f00c3473bf8e75e Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 2 Apr 2022 13:19:37 +0200 Subject: [PATCH 055/121] Repo: add permissions field (#476) Adds field `repoPermissions` to `Repo` record. --- src/GitHub/Data/Repos.hs | 21 +++++++++++++++++++++ src/GitHub/Endpoints/Repos.hs | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/GitHub/Data/Repos.hs b/src/GitHub/Data/Repos.hs index d9c9cf1b..0019b173 100644 --- a/src/GitHub/Data/Repos.hs +++ b/src/GitHub/Data/Repos.hs @@ -61,12 +61,26 @@ data Repo = Repo , repoPushedAt :: !(Maybe UTCTime) -- ^ this is Nothing for new repositories , repoCreatedAt :: !(Maybe UTCTime) , repoUpdatedAt :: !(Maybe UTCTime) + , repoPermissions :: !(Maybe RepoPermissions) -- ^ Repository permissions as they relate to the authenticated user. } deriving (Show, Data, Typeable, Eq, Ord, Generic) instance NFData Repo where rnf = genericRnf instance Binary Repo +-- | Repository permissions, as they relate to the authenticated user. +-- +-- Returned by for example 'GitHub.Endpoints.Repos.currentUserReposR' +data RepoPermissions = RepoPermissions + { repoPermissionAdmin :: !Bool + , repoPermissionPush :: !Bool + , repoPermissionPull :: !Bool + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData RepoPermissions where rnf = genericRnf +instance Binary RepoPermissions + data RepoRef = RepoRef { repoRefOwner :: !SimpleOwner , repoRefRepo :: !(Name Repo) @@ -214,6 +228,7 @@ instance FromJSON Repo where <*> o .:? "pushed_at" <*> o .:? "created_at" <*> o .:? "updated_at" + <*> o .:? "permissions" instance ToJSON NewRepo where toJSON (NewRepo { newRepoName = name @@ -273,6 +288,12 @@ instance ToJSON EditRepo where , "archived" .= archived ] +instance FromJSON RepoPermissions where + parseJSON = withObject "RepoPermissions" $ \o -> RepoPermissions + <$> o .: "admin" + <*> o .: "push" + <*> o .: "pull" + instance FromJSON RepoRef where parseJSON = withObject "RepoRef" $ \o -> RepoRef <$> o .: "owner" diff --git a/src/GitHub/Endpoints/Repos.hs b/src/GitHub/Endpoints/Repos.hs index 38fe1e6f..b8c9d79d 100644 --- a/src/GitHub/Endpoints/Repos.hs +++ b/src/GitHub/Endpoints/Repos.hs @@ -43,7 +43,7 @@ repoPublicityQueryString RepoPublicityPublic = [("type", Just "public")] repoPublicityQueryString RepoPublicityPrivate = [("type", Just "private")] -- | List your repositories. --- See +-- See currentUserReposR :: RepoPublicity -> FetchCount -> Request k (Vector Repo) currentUserReposR publicity = pagedQuery ["user", "repos"] qs @@ -51,7 +51,7 @@ currentUserReposR publicity = qs = repoPublicityQueryString publicity -- | List user repositories. --- See +-- See userReposR :: Name Owner -> RepoPublicity -> FetchCount -> Request k(Vector Repo) userReposR user publicity = pagedQuery ["users", toPathPart user, "repos"] qs @@ -59,7 +59,7 @@ userReposR user publicity = qs = repoPublicityQueryString publicity -- | List organization repositories. --- See +-- See organizationReposR :: Name Organization -> RepoPublicity From e619f76caf672cc78b676f56755e362dc1c838b8 Mon Sep 17 00:00:00 2001 From: Andrea Bedini Date: Mon, 4 Apr 2022 06:13:22 +0800 Subject: [PATCH 056/121] Replace Travis CI with GitHub Actions in README (#475) --- README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 0a27ff91..18313f24 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ GitHub ------ -[![Build Status](https://travis-ci.org/phadej/github.svg?branch=master)](https://travis-ci.org/phadej/github) +[![Haskell-CI](https://github.com/haskell-github/github/actions/workflows/haskell-ci.yml/badge.svg)](https://github.com/haskell-github/github/actions/workflows/haskell-ci.yml) [![Hackage](https://img.shields.io/hackage/v/github.svg)][hackage] The GitHub API v3 for Haskell. @@ -30,7 +30,7 @@ Example Usage ============= See the samples in the -[samples/](https://github.com/fpco/github/tree/master/samples) directory. +[samples/](https://github.com/haskell-github/github/tree/master/samples) directory. Note: some samples might be outdated. @@ -51,7 +51,7 @@ you want. You must call the function using IO goodness, then dispatch on the possible error message. Here's an example from the samples: Many function have samples under -[`samples/`](https://github.com/phadej/github/tree/master/samples) directory. +[`samples/`](https://github.com/haskell-github/github/tree/master/samples) directory. ```hs {-# LANGUAGE NoImplicitPrelude #-} @@ -77,21 +77,11 @@ formatUser :: GitHub.SimpleUser -> Text formatUser = GitHub.untagName . GitHub.simpleUserLogin ``` -Test setup -========== - -To run integration part of tests, you'll need [github access token](https://github.com/settings/tokens/new) -Token is needed, because unauthorised access is highly limited. -It's enough to add only basic read access for public information. - -With `travis encrypt --org --repo yournick/github "GITHUB_TOKEN=yourtoken"` command you get a secret, -you can use in your travis setup to run the test-suite there. - Contributions ============= Please see -[CONTRIBUTING.md](https://github.com/fpco/github/blob/master/CONTRIBUTING.md) +[CONTRIBUTING.md](https://github.com/haskell-github/github/blob/master/CONTRIBUTING.md) for details on how you can help. Copyright From 86ab6944b26b346ca4d4490a30b241cd8c42b19a Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 19 Apr 2022 14:18:10 +0200 Subject: [PATCH 057/121] Close #355: comment that haddocks only build from GHC 8.6 --- cabal.haskell-ci | 1 + 1 file changed, 1 insertion(+) diff --git a/cabal.haskell-ci b/cabal.haskell-ci index bcb8a5d9..ddf7ff7b 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -1,2 +1,3 @@ branches: master haddock: >=8.6 + -- See PR #355: haddocks for GADT constructor arguments only supported from GHC 8.6 From 4c922eb3edf82473cc78dc9b85911cbd8d4610e5 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 19 Apr 2022 17:16:42 +0200 Subject: [PATCH 058/121] Update `CreateIssue.hs` to new request model and OAuth (#477) * Fix compiler errors * If there are no labels, than the output should be an empty array. * Move formatUser to own function * Remove empty line * Update CreateIssue.hs to request model & OAuth; add cabal entry (#195) Can be run as follows: samples/$ GITHUB_TOKEN=<> cabal run github-create-issue * Drop testing with GHC-7.8.4 Drop building `samples` with GHC-7.8 because `System.Exit.die` is only available from GHC 7.10. * Restore testing with GHC-7.8.4 except for samples Co-authored-by: Amitaibu --- .github/workflows/haskell-ci.yml | 26 ++++++------- cabal.haskell-ci | 1 + github.cabal | 4 +- samples/Issues/CreateIssue.hs | 67 +++++++++++++++++++++++--------- samples/github-samples.cabal | 18 ++++++--- 5 files changed, 77 insertions(+), 39 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 463233e7..bbd13145 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.13.20211111 +# version: 0.14.3.20220416 # -# REGENDATA ("0.13.20211111",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.14.3.20220416",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -32,15 +32,15 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.2.1 + - compiler: ghc-9.2.2 compilerKind: ghc - compilerVersion: 9.2.1 + compilerVersion: 9.2.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.0.1 + - compiler: ghc-9.0.2 compilerKind: ghc - compilerVersion: 9.0.1 - setup-method: hvr-ppa + compilerVersion: 9.0.2 + setup-method: ghcup allow-failure: false - compiler: ghc-8.10.7 compilerKind: ghc @@ -90,7 +90,7 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 if [ "${{ matrix.setup-method }}" = ghcup ]; then mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 @@ -99,7 +99,7 @@ jobs: apt-get update apt-get install -y "$HCNAME" mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 fi @@ -191,7 +191,7 @@ jobs: run: | touch cabal.project echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project - echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project + if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project ; fi cat cabal.project - name: sdist run: | @@ -211,7 +211,7 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_github}" >> cabal.project - echo "packages: ${PKGDIR_github_samples}" >> cabal.project + if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi @@ -256,8 +256,8 @@ jobs: run: | cd ${PKGDIR_github} || false ${CABAL} -vnormal check - cd ${PKGDIR_github_samples} || false - ${CABAL} -vnormal check + if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then cd ${PKGDIR_github_samples} || false ; fi + if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi - name: haddock run: | if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi diff --git a/cabal.haskell-ci b/cabal.haskell-ci index ddf7ff7b..eb8a2be2 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -1,3 +1,4 @@ branches: master haddock: >=8.6 -- See PR #355: haddocks for GADT constructor arguments only supported from GHC 8.6 +jobs-selection: any diff --git a/github.cabal b/github.cabal index be54e398..04cb2c9a 100644 --- a/github.cabal +++ b/github.cabal @@ -38,8 +38,8 @@ tested-with: || ==8.6.5 || ==8.8.4 || ==8.10.7 - || ==9.0.1 - || ==9.2.1 + || ==9.0.2 + || ==9.2.2 extra-source-files: README.md diff --git a/samples/Issues/CreateIssue.hs b/samples/Issues/CreateIssue.hs index 296013f5..6d930c93 100644 --- a/samples/Issues/CreateIssue.hs +++ b/samples/Issues/CreateIssue.hs @@ -1,22 +1,53 @@ +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} -module CreateIssue where -import qualified Github.Auth as Github -import qualified Github.Issues as Github +import Data.String (fromString) +import qualified Data.Text as Text (unpack) +import qualified Data.Vector as Vector (fromList) +import qualified GitHub.Auth as GitHub +import qualified GitHub.Data.Issues as GitHub +import qualified GitHub.Endpoints.Issues as GitHub +import qualified GitHub.Request as GitHub + +import System.Environment (lookupEnv) +import qualified System.Exit as Exit (die) + +self :: String +self = "github-create-issue" + +main :: IO () main = do - let auth = Github.BasicAuth "user" "password" - newiss = (Github.newIssue "A new issue") { - Github.newIssueBody = Just "Issue description text goes here" + token <- lookupEnv "GITHUB_TOKEN" >>= \case + Nothing -> die "variable GITHUB_TOKEN not set" + Just token -> return $ fromString token + + let auth = GitHub.OAuth token + newiss = (GitHub.newIssue "A new issue") + { GitHub.newIssueBody = Just "Issue description text goes here" + , GitHub.newIssueLabels = Just $ Vector.fromList ["foo", "bar", "baz"] } - possibleIssue <- Github.createIssue auth "thoughtbot" "paperclip" newiss - putStrLn $ either (\e -> "Error: " ++ show e) - formatIssue - possibleIssue - -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) + request = GitHub.createIssueR "haskell-github" "playground" newiss + + GitHub.github auth request >>= \case + Left err -> die $ show err + Right issue -> putStrLn $ formatIssue issue + +die :: String -> IO a +die msg = Exit.die $ concat [ self, ": Error: ", msg ] + +formatIssue :: GitHub.Issue -> String +formatIssue issue = concat + [ formatUser issue + , " opened this issue " + , show $ GitHub.issueCreatedAt issue + , "\n" + , show $ GitHub.issueState issue + , " with " + , show $ GitHub.issueComments issue + , " comments\n\n" + , Text.unpack $ GitHub.issueTitle issue + ] + +formatUser :: GitHub.Issue -> String +formatUser issue = + Text.unpack . GitHub.untagName . GitHub.simpleUserLogin $ GitHub.issueUser issue diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index f1ff2045..d71cd143 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -9,16 +9,15 @@ maintainer: Oleg Grenrus description: Various samples of github package build-type: Simple tested-with: - GHC ==7.8.4 - || ==7.10.3 + GHC ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 - || ==9.0.1 - || ==9.2.1 + || ==9.0.2 + || ==9.2.2 library hs-source-dirs: src @@ -50,9 +49,11 @@ executable github-operational common deps default-language: Haskell2010 - ghc-options: -Wall + ghc-options: + -Wall + -threaded build-depends: - , base >=4.7 && <5 + , base >=4.8 && <5 , base-compat-batteries , base64-bytestring , github @@ -70,6 +71,11 @@ executable github-create-deploy-key main-is: CreateDeployKey.hs hs-source-dirs: Repos/DeployKeys +executable github-create-issue + import: deps + main-is: CreateIssue.hs + hs-source-dirs: Issues + -- executable github-delete-deploy-key -- import: deps -- main-is: DeleteDeployKey.hs From 59967287df3128fa93a9a6edc95d1b3911e1e1ec Mon Sep 17 00:00:00 2001 From: Owen Shepherd <414owen@gmail.com> Date: Fri, 29 Apr 2022 13:32:32 +0100 Subject: [PATCH 059/121] Add unwatch request (#473) - Add unsubscribe request - Add unwatch request sample - Add Unwatch sample to github-samples.cabal --- samples/Repos/Watching/Unwatch.hs | 17 +++++++++++++++++ samples/github-samples.cabal | 6 ++++++ src/GitHub.hs | 2 +- src/GitHub/Endpoints/Activity/Watching.hs | 7 +++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 samples/Repos/Watching/Unwatch.hs diff --git a/samples/Repos/Watching/Unwatch.hs b/samples/Repos/Watching/Unwatch.hs new file mode 100644 index 00000000..42dc28a8 --- /dev/null +++ b/samples/Repos/Watching/Unwatch.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Main where + +import qualified GitHub as GH +import qualified Data.Text as T +import qualified Data.Text.IO as T + +main :: IO () +main = do + let auth = GH.BasicAuth "" "" + owner = "haskell-github" + repo = "github" + result <- GH.github auth GH.unwatchRepoR (GH.mkOwnerName owner) (GH.mkRepoName repo) + case result of + Left err -> putStrLn $ "Error: " ++ show err + Right () -> T.putStrLn $ T.concat ["No longer watching: ", owner, "/", repo] diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index d71cd143..1182fdf4 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -166,6 +166,12 @@ executable github-teaminfo-for main-is: TeamInfoFor.hs hs-source-dirs: Teams +executable github-unwatch-repo + import: deps + main-is: Unwatch.hs + ghc-options: -Wall -threaded + hs-source-dirs: Repos/Watching + -- executable github-create-public-ssh-key -- import: deps -- main-is: CreatePublicSSHKey.hs diff --git a/src/GitHub.hs b/src/GitHub.hs index e00a53cb..da5e9f2b 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -52,9 +52,9 @@ module GitHub ( -- -- * Query a Repository Subscription -- * Set a Repository Subscription - -- * Delete a Repository Subscription watchersForR, reposWatchedByR, + unwatchRepoR, -- * Gists -- | See diff --git a/src/GitHub/Endpoints/Activity/Watching.hs b/src/GitHub/Endpoints/Activity/Watching.hs index cd58b44f..92b7829d 100644 --- a/src/GitHub/Endpoints/Activity/Watching.hs +++ b/src/GitHub/Endpoints/Activity/Watching.hs @@ -8,6 +8,7 @@ module GitHub.Endpoints.Activity.Watching ( watchersForR, reposWatchedByR, + unwatchRepoR, module GitHub.Data, ) where @@ -27,3 +28,9 @@ watchersForR user repo limit = reposWatchedByR :: Name Owner -> FetchCount -> Request k (Vector Repo) reposWatchedByR user = pagedQuery ["users", toPathPart user, "subscriptions"] [] + +-- | Stop watching repository. +-- See +unwatchRepoR :: Name Owner -> Name Repo -> Request 'RW () +unwatchRepoR owner repo = + command Delete ["repos", toPathPart owner, toPathPart repo, "subscription"] mempty From 83acdf8f4c7d525c896e9d12494be65a628007c3 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Fri, 29 Apr 2022 20:49:41 +0100 Subject: [PATCH 060/121] Make searches paginated (#474) Previously, searches only returned the first thirty results, and there was no way to access page two. Note that this is a breaking API change. - Add paginated searches - Update SearchCode sample to use pagination - Update SearchIssues sample to use pagination - Update SearchRepos sample to use pagination --- samples/Search/SearchCode.hs | 39 ++++++++++---------- samples/Search/SearchIssues.hs | 37 ++++++++++--------- samples/Search/SearchRepos.hs | 57 +++++++++++++++-------------- samples/github-samples.cabal | 19 ++++++++++ spec/GitHub/SearchSpec.hs | 6 ++-- src/GitHub/Data/Repos.hs | 65 ++++++++++++++++++++++++++++++++++ src/GitHub/Data/Search.hs | 24 ++++++++----- src/GitHub/Endpoints/Search.hs | 16 ++++----- 8 files changed, 180 insertions(+), 83 deletions(-) diff --git a/samples/Search/SearchCode.hs b/samples/Search/SearchCode.hs index 68a73c96..c632e2ae 100644 --- a/samples/Search/SearchCode.hs +++ b/samples/Search/SearchCode.hs @@ -1,34 +1,33 @@ {-# LANGUAGE OverloadedStrings #-} -module SearchCode where -import qualified Github.Search as Github -import qualified Github.Data as Github -import Control.Monad (forM,forM_) -import Data.Maybe (fromMaybe) +module Main where + +import qualified GitHub +import Control.Monad (forM_) import Data.List (intercalate) +import qualified Data.Text as T +main :: IO () main = do - let query = "q=Code repo:jwiegley/github&per_page=100" - let auth = Nothing - result <- Github.searchCode' auth query + let query = "Code repo:haskell-github/github" + result <- GitHub.github' GitHub.searchCodeR query 1000 case result of Left e -> putStrLn $ "Error: " ++ show e - Right r -> do forM_ (Github.searchCodeCodes r) (\r -> do - putStrLn $ formatCode r - putStrLn "" - ) - putStrLn $ "Count: " ++ show n ++ " matches for the query: \"" ++ query ++ "\"" - where n = Github.searchCodeTotalCount r + Right r -> do + forM_ (GitHub.searchResultResults r) $ \r -> do + putStrLn $ formatCode r + putStrLn "" + putStrLn $ "Count: " ++ show (GitHub.searchResultTotalCount r) + ++ " matches for the query: \"" ++ T.unpack query ++ "\"" -formatCode :: Github.Code -> String +formatCode :: GitHub.Code -> String formatCode r = - let fields = [ ("Name", Github.codeName) - ,("Path", Github.codePath) - ,("Sha", Github.codeSha) - ,("URL", Github.codeHtmlUrl) + let fields = [ ("Name", show . GitHub.codeName) + , ("Path", show . GitHub.codePath) + , ("Sha", show . GitHub.codeSha) + , ("URL", show . GitHub.codeHtmlUrl) ] in intercalate "\n" $ map fmt fields where fmt (s,f) = fill 12 (s ++ ":") ++ " " ++ f r fill n s = s ++ replicate n' ' ' where n' = max 0 (n - length s) - diff --git a/samples/Search/SearchIssues.hs b/samples/Search/SearchIssues.hs index 9b86ac22..288aef73 100644 --- a/samples/Search/SearchIssues.hs +++ b/samples/Search/SearchIssues.hs @@ -1,26 +1,29 @@ {-# LANGUAGE OverloadedStrings #-} -module SearchIssues where +module Main where -import qualified Github.Search as Github +import qualified GitHub +import qualified Data.Text as T import Control.Monad (forM_) +import Data.Monoid ((<>)) +main :: IO () main = do - let query = "q=build%20repo%3Aphadej%2Fgithub&per_page=100" - let auth = Nothing - result <- Github.searchIssues' auth query + let query = "build repo:haskell-github/github" + result <- GitHub.github' GitHub.searchIssuesR query 1000 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 + Right r -> do + forM_ (GitHub.searchResultResults r) $ \r -> do + putStrLn $ formatIssue r + putStrLn "" + putStrLn $ "Count: " ++ show (GitHub.searchResultTotalCount r) + ++ " matches for the query: \"" ++ T.unpack query ++ "\"" +formatIssue :: GitHub.Issue -> String 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) + (show $ GitHub.issueUser issue) <> + " opened this issue " <> + (show $ GitHub.issueCreatedAt issue) <> "\n" <> + (show $ GitHub.issueState issue) <> " with " <> + (show $ GitHub.issueComments issue) <> " comments" <> "\n\n" <> + (T.unpack $ GitHub.issueTitle issue) diff --git a/samples/Search/SearchRepos.hs b/samples/Search/SearchRepos.hs index ade7f784..0a558b7e 100644 --- a/samples/Search/SearchRepos.hs +++ b/samples/Search/SearchRepos.hs @@ -1,50 +1,52 @@ {-# LANGUAGE OverloadedStrings #-} -module SearchRepos where +module Main where -import qualified Github.Search as Github -import qualified Github.Data as Github -import Control.Monad (forM,forM_) +import qualified GitHub +import Control.Monad (forM_) import Data.Maybe (fromMaybe) +import Data.Monoid ((<>)) import Data.List (intercalate) import System.Environment (getArgs) import Text.Printf (printf) import Data.Time.Clock (getCurrentTime, UTCTime(..)) -import Data.Time.LocalTime (utc,utcToLocalTime,localDay,localTimeOfDay,TimeOfDay(..)) +import Data.Time.LocalTime (utc,utcToLocalTime,localDay) import Data.Time.Calendar (toGregorian) +import Data.Text (Text) +import qualified Data.Text as T +main :: IO () main = do args <- getArgs date <- case args of - (x:_) -> return x - otherwise -> today - let query = "q=language%3Ahaskell created%3A>" ++ date ++ "&per_page=100" - let auth = Nothing - result <- Github.searchRepos' auth query + (x:_) -> return $ T.pack x + _ -> today + let query = ("language:haskell created:>" <> date) :: Text + result <- GitHub.github' GitHub.searchReposR query 1000 case result of Left e -> putStrLn $ "Error: " ++ show e - Right r -> do forM_ (Github.searchReposRepos r) (\r -> do - putStrLn $ formatRepo r - putStrLn "" - ) - putStrLn $ "Count: " ++ show n ++ " Haskell repos created since " ++ date - where n = Github.searchReposTotalCount r + Right r -> do + forM_ (GitHub.searchResultResults r) $ \r -> do + putStrLn $ formatRepo r + putStrLn "" + putStrLn $ "Count: " ++ show (GitHub.searchResultTotalCount r) + ++ " Haskell repos created since " ++ T.unpack date -- | return today (in UTC) formatted as YYYY-MM-DD -today :: IO String +today :: IO Text today = do now <- getCurrentTime let day = localDay $ utcToLocalTime utc now (y,m,d) = toGregorian day - in return $ printf "%d-%02d-%02d" y m d + in return $ T.pack $ printf "%d-%02d-%02d" y m d -formatRepo :: Github.Repo -> String +formatRepo :: GitHub.Repo -> String formatRepo r = - let fields = [ ("Name", Github.repoName) - ,("URL", Github.repoHtmlUrl) - ,("Description", orEmpty . Github.repoDescription) - ,("Created-At", formatMaybeDate . Github.repoCreatedAt) - ,("Pushed-At", formatMaybeDate . Github.repoPushedAt) - ,("Stars", show . Github.repoStargazersCount) + let fields = [ ("Name", show . GitHub.repoName) + ,("URL", show . GitHub.repoHtmlUrl) + ,("Description", show . orEmpty . GitHub.repoDescription) + ,("Created-At", formatMaybeDate . GitHub.repoCreatedAt) + ,("Pushed-At", formatMaybeDate . GitHub.repoPushedAt) + ,("Stars", show . GitHub.repoStargazersCount) ] in intercalate "\n" $ map fmt fields where fmt (s,f) = fill 12 (s ++ ":") ++ " " ++ f r @@ -52,5 +54,6 @@ formatRepo r = fill n s = s ++ replicate n' ' ' where n' = max 0 (n - length s) -formatMaybeDate = maybe "???" formatDate -formatDate = show . Github.fromDate + +formatMaybeDate :: Maybe UTCTime -> String +formatMaybeDate = maybe "???" show diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 1182fdf4..43b5ac3c 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -156,6 +156,25 @@ executable github-show-user-2 main-is: ShowUser2.hs hs-source-dirs: Users +executable github-search-code + import: deps + ghc-options: -Wall -threaded + main-is: SearchCode.hs + hs-source-dirs: Search + +executable github-search-issues + import: deps + ghc-options: -Wall -threaded + main-is: SearchIssues.hs + hs-source-dirs: Search + +executable github-search-repos + import: deps + ghc-options: -Wall -threaded + main-is: SearchRepos.hs + hs-source-dirs: Search + build-depends: time + -- executable github-team-membership-info-for -- import: deps -- main-is: TeamMembershipInfoFor.hs diff --git a/spec/GitHub/SearchSpec.hs b/spec/GitHub/SearchSpec.hs index 5cc5a15f..f82a2051 100644 --- a/spec/GitHub/SearchSpec.hs +++ b/spec/GitHub/SearchSpec.hs @@ -18,7 +18,7 @@ import GitHub (github) import GitHub.Data (Auth (..), Issue (..), IssueNumber (..), IssueState (..), SimpleUser (..), User, mkId) -import GitHub.Endpoints.Search (SearchResult (..), searchIssuesR, searchUsersR) +import GitHub.Endpoints.Search (SearchResult' (..), SearchResult, searchIssuesR, searchUsersR) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -55,13 +55,13 @@ spec = do it "performs an issue search via the API" $ withAuth $ \auth -> do let query = "Decouple in:title repo:phadej/github created:<=2015-12-01" - issues <- searchResultResults . fromRightS <$> github auth searchIssuesR query + issues <- fmap (searchResultResults . fromRightS) <$> github auth $ searchIssuesR query 5 length issues `shouldBe` 1 issueId (V.head issues) `shouldBe` mkId (Proxy :: Proxy Issue) 119694665 describe "searchUsers" $ it "performs a user search via the API" $ withAuth $ \auth -> do let query = "oleg.grenrus@iki.fi created:<2020-01-01" - users <- searchResultResults . fromRightS <$> github auth searchUsersR query + users <- fmap (searchResultResults . fromRightS) <$> github auth $ searchUsersR query 5 length users `shouldBe` 1 simpleUserId (V.head users) `shouldBe` mkId (Proxy :: Proxy User) 51087 diff --git a/src/GitHub/Data/Repos.hs b/src/GitHub/Data/Repos.hs index 0019b173..63779d77 100644 --- a/src/GitHub/Data/Repos.hs +++ b/src/GitHub/Data/Repos.hs @@ -68,6 +68,41 @@ data Repo = Repo instance NFData Repo where rnf = genericRnf instance Binary Repo +data CodeSearchRepo = CodeSearchRepo + { codeSearchRepoId :: !(Id Repo) + , codeSearchRepoName :: !(Name Repo) + , codeSearchRepoOwner :: !SimpleOwner + , codeSearchRepoPrivate :: !Bool + , codeSearchRepoHtmlUrl :: !URL + , codeSearchRepoDescription :: !(Maybe Text) + , codeSearchRepoFork :: !(Maybe Bool) + , codeSearchRepoUrl :: !URL + , codeSearchRepoGitUrl :: !(Maybe URL) + , codeSearchRepoSshUrl :: !(Maybe URL) + , codeSearchRepoCloneUrl :: !(Maybe URL) + , codeSearchRepoHooksUrl :: !URL + , codeSearchRepoSvnUrl :: !(Maybe URL) + , codeSearchRepoHomepage :: !(Maybe Text) + , codeSearchRepoLanguage :: !(Maybe Language) + , codeSearchRepoSize :: !(Maybe Int) + , codeSearchRepoDefaultBranch :: !(Maybe Text) + , codeSearchRepoHasIssues :: !(Maybe Bool) + , codeSearchRepoHasProjects :: !(Maybe Bool) + , codeSearchRepoHasWiki :: !(Maybe Bool) + , codeSearchRepoHasPages :: !(Maybe Bool) + , codeSearchRepoHasDownloads :: !(Maybe Bool) + , codeSearchRepoArchived :: !Bool + , codeSearchRepoDisabled :: !Bool + , codeSearchRepoPushedAt :: !(Maybe UTCTime) -- ^ this is Nothing for new repositories + , codeSearchRepoCreatedAt :: !(Maybe UTCTime) + , codeSearchRepoUpdatedAt :: !(Maybe UTCTime) + , codeSearchRepoPermissions :: !(Maybe RepoPermissions) -- ^ Repository permissions as they relate to the authenticated user. + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData CodeSearchRepo where rnf = genericRnf +instance Binary CodeSearchRepo + -- | Repository permissions, as they relate to the authenticated user. -- -- Returned by for example 'GitHub.Endpoints.Repos.currentUserReposR' @@ -230,6 +265,36 @@ instance FromJSON Repo where <*> o .:? "updated_at" <*> o .:? "permissions" +instance FromJSON CodeSearchRepo where + parseJSON = withObject "Repo" $ \o -> CodeSearchRepo <$> o .: "id" + <*> o .: "name" + <*> o .: "owner" + <*> o .: "private" + <*> o .: "html_url" + <*> o .:? "description" + <*> o .: "fork" + <*> o .: "url" + <*> o .:? "git_url" + <*> o .:? "ssh_url" + <*> o .:? "clone_url" + <*> o .: "hooks_url" + <*> o .:? "svn_url" + <*> o .:? "homepage" + <*> o .:? "language" + <*> o .:? "size" + <*> o .:? "default_branch" + <*> o .:? "has_issues" + <*> o .:? "has_projects" + <*> o .:? "has_wiki" + <*> o .:? "has_pages" + <*> o .:? "has_downloads" + <*> o .:? "archived" .!= False + <*> o .:? "disabled" .!= False + <*> o .:? "pushed_at" + <*> o .:? "created_at" + <*> o .:? "updated_at" + <*> o .:? "permissions" + instance ToJSON NewRepo where toJSON (NewRepo { newRepoName = name , newRepoDescription = description diff --git a/src/GitHub/Data/Search.hs b/src/GitHub/Data/Search.hs index cfef5ca1..951d1c83 100644 --- a/src/GitHub/Data/Search.hs +++ b/src/GitHub/Data/Search.hs @@ -5,26 +5,34 @@ -- module GitHub.Data.Search where -import GitHub.Data.Repos (Repo) +import GitHub.Data.Repos (CodeSearchRepo) import GitHub.Data.URL (URL) import GitHub.Internal.Prelude import Prelude () import qualified Data.Vector as V -data SearchResult entity = SearchResult +data SearchResult' entities = SearchResult { searchResultTotalCount :: !Int - , searchResultResults :: !(Vector entity) + , searchResultResults :: !entities } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData entity => NFData (SearchResult entity) where rnf = genericRnf -instance Binary entity => Binary (SearchResult entity) +type SearchResult entity = SearchResult' (V.Vector entity) -instance FromJSON entity => FromJSON (SearchResult entity) where +instance NFData entities => NFData (SearchResult' entities) where rnf = genericRnf +instance Binary entities => Binary (SearchResult' entities) + +instance (Monoid entities, FromJSON entities) => FromJSON (SearchResult' entities) where parseJSON = withObject "SearchResult" $ \o -> SearchResult <$> o .: "total_count" - <*> o .:? "items" .!= V.empty + <*> o .:? "items" .!= mempty + +instance Semigroup res => Semigroup (SearchResult' res) where + (SearchResult count res) <> (SearchResult count' res') = SearchResult (max count count') (res <> res') + +instance Foldable SearchResult' where + foldMap f (SearchResult count results) = f results data Code = Code { codeName :: !Text @@ -33,7 +41,7 @@ data Code = Code , codeUrl :: !URL , codeGitUrl :: !URL , codeHtmlUrl :: !URL - , codeRepo :: !Repo + , codeRepo :: !CodeSearchRepo } deriving (Show, Data, Typeable, Eq, Ord, Generic) diff --git a/src/GitHub/Endpoints/Search.hs b/src/GitHub/Endpoints/Search.hs index 3fb50e85..36b8c414 100644 --- a/src/GitHub/Endpoints/Search.hs +++ b/src/GitHub/Endpoints/Search.hs @@ -21,24 +21,24 @@ import qualified Data.Text.Encoding as TE -- | Search repositories. -- See -searchReposR :: Text -> Request k (SearchResult Repo) +searchReposR :: Text -> FetchCount -> Request k (SearchResult Repo) searchReposR searchString = - query ["search", "repositories"] [("q", Just $ TE.encodeUtf8 searchString)] + PagedQuery ["search", "repositories"] [("q", Just $ TE.encodeUtf8 searchString)] -- | Search code. -- See -searchCodeR :: Text -> Request k (SearchResult Code) +searchCodeR :: Text -> FetchCount -> Request k (SearchResult Code) searchCodeR searchString = - query ["search", "code"] [("q", Just $ TE.encodeUtf8 searchString)] + PagedQuery ["search", "code"] [("q", Just $ TE.encodeUtf8 searchString)] -- | Search issues. -- See -searchIssuesR :: Text -> Request k (SearchResult Issue) +searchIssuesR :: Text -> FetchCount -> Request k (SearchResult Issue) searchIssuesR searchString = - query ["search", "issues"] [("q", Just $ TE.encodeUtf8 searchString)] + PagedQuery ["search", "issues"] [("q", Just $ TE.encodeUtf8 searchString)] -- | Search users. -- See -searchUsersR :: Text -> Request k (SearchResult SimpleUser) +searchUsersR :: Text -> FetchCount -> Request k (SearchResult SimpleUser) searchUsersR searchString = - query ["search", "users"] [("q", Just $ TE.encodeUtf8 searchString)] + PagedQuery ["search", "users"] [("q", Just $ TE.encodeUtf8 searchString)] From d07a9f992b3c7afb1429683198cb3045e530dc2b Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 19 Apr 2022 17:58:38 +0200 Subject: [PATCH 061/121] Fix whitespace in {*hs, *.md} files --- CHANGELOG.md | 6 +++--- samples/GitData/References/GitCreateReference.hs | 2 +- samples/Issues/IssueReport/Issues.hs | 8 ++++---- samples/Issues/IssueReport/IssuesEnterprise.hs | 8 ++++---- samples/Issues/IssueReport/Report.hs | 2 +- samples/Repos/Commits/GitShow.hs | 2 +- samples/Repos/DeployKeys/ShowDeployKey.hs | 1 - samples/Search/SearchCode.hs | 2 +- samples/Search/SearchRepos.hs | 2 +- samples/Users/Followers/ListFollowers.hs | 2 +- samples/Users/Followers/ListFollowing.hs | 2 +- spec/GitHub/ActivitySpec.hs | 2 +- spec/GitHub/EventsSpec.hs | 2 +- src/GitHub/Data/Events.hs | 4 ++-- 14 files changed, 22 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eddba7a7..10cc9b18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ [#455](https://github.com/phadej/github/pull/455) - Update RepoWebhookEvent [#461](https://github.com/phadej/github/pull/461) -- PullRequest Reviews may not have submitted_at field +- PullRequest Reviews may not have submitted_at field [#450](https://github.com/phadej/github/pull/450) ## Changes for 0.26 @@ -23,7 +23,7 @@ [#417](https://github.com/phadej/github/pull/417) - Add deleteReference endpoint [#388](https://github.com/phadej/github/pull/388) - + ## Changes for 0.25 - Add `executeRequestWithMgrAndRes` @@ -145,7 +145,7 @@ This reduces symbol bloat in the library. [#307](https://github.com/phadej/github/pull/307) - Make "repo" in PullRequestCommit nullable (repository can be gone) [#311](https://github.com/phadej/github/pull/311) -- Add read-only emails endpoint +- Add read-only emails endpoint [#313](https://github.com/phadej/github/pull/313) - Organisation membership API [#312](https://github.com/phadej/github/pull/312) diff --git a/samples/GitData/References/GitCreateReference.hs b/samples/GitData/References/GitCreateReference.hs index bf3d15b0..e56e1a2a 100644 --- a/samples/GitData/References/GitCreateReference.hs +++ b/samples/GitData/References/GitCreateReference.hs @@ -13,7 +13,7 @@ main = do case newlyCreatedGitRef of (Left err) -> putStrLn $ "Error: " ++ show err (Right newRef) -> putStrLn . formatReference $ newRef - + formatReference :: GitReference -> String formatReference ref = (gitObjectSha $ gitReferenceObject ref) ++ "\t" ++ (gitReferenceRef ref) diff --git a/samples/Issues/IssueReport/Issues.hs b/samples/Issues/IssueReport/Issues.hs index 14ce129c..da2fb1ba 100644 --- a/samples/Issues/IssueReport/Issues.hs +++ b/samples/Issues/IssueReport/Issues.hs @@ -18,12 +18,12 @@ mkIssue (Issue n t h) = hsep [ fill 5 (text (show h))] vissues :: ([Doc], [Doc], [Doc]) -> Doc -vissues (x, y, z) = hsep [(vcat x), align (vcat y), align (vcat z)] +vissues (x, y, z) = hsep [(vcat x), align (vcat y), align (vcat z)] mkDoc :: Report -> Doc mkDoc (Report issues total) = vsep [ text "Report for the milestone", - (vsep . map mkIssue) issues, + (vsep . map mkIssue) issues, text ("Total hours : " ++ (show total) ++" hours") ] @@ -31,7 +31,7 @@ mkFullDoc :: [Github.Issue] -> Doc mkFullDoc = mkDoc . prepareReport -- The public repo is used as private are quite sensitive for this report --- +-- -- The main idea is to use labels like 1h, 2h etc for man-hour estimation of issues -- on private repos for development "on hire" -- @@ -43,4 +43,4 @@ main = do possibleIssues <- Github.issuesForRepo' auth "paulrzcz" "hquantlib" limitations case possibleIssues of (Left err) -> putStrLn $ "Error: " ++ show err - (Right issues) -> putDoc $ mkFullDoc issues + (Right issues) -> putDoc $ mkFullDoc issues diff --git a/samples/Issues/IssueReport/IssuesEnterprise.hs b/samples/Issues/IssueReport/IssuesEnterprise.hs index 6b9f899c..7b2c2531 100644 --- a/samples/Issues/IssueReport/IssuesEnterprise.hs +++ b/samples/Issues/IssueReport/IssuesEnterprise.hs @@ -20,12 +20,12 @@ mkIssue (Issue n t h) = hsep [ fill 5 (text (show h))] vissues :: ([Doc], [Doc], [Doc]) -> Doc -vissues (x, y, z) = hsep [(vcat x), align (vcat y), align (vcat z)] +vissues (x, y, z) = hsep [(vcat x), align (vcat y), align (vcat z)] mkDoc :: Report -> Doc mkDoc (Report issues total) = vsep [ text "Report for the milestone", - (vsep . map mkIssue) issues, + (vsep . map mkIssue) issues, text ("Total hours : " ++ (show total) ++" hours") ] @@ -33,7 +33,7 @@ mkFullDoc :: [Github.Issue] -> Doc mkFullDoc = mkDoc . prepareReport -- The public repo is used as private are quite sensitive for this report --- +-- -- The main idea is to use labels like 1h, 2h etc for man-hour estimation of issues -- on private repos for development "on hire" -- @@ -45,4 +45,4 @@ main = do possibleIssues <- Github.issuesForRepo' auth "paulrzcz" "hquantlib" limitations case possibleIssues of (Left err) -> putStrLn $ "Error: " ++ show err - (Right issues) -> putDoc $ mkFullDoc issues + (Right issues) -> putDoc $ mkFullDoc issues diff --git a/samples/Issues/IssueReport/Report.hs b/samples/Issues/IssueReport/Report.hs index 307bba95..76abe4f8 100644 --- a/samples/Issues/IssueReport/Report.hs +++ b/samples/Issues/IssueReport/Report.hs @@ -45,7 +45,7 @@ sumUp = foldl s 0.0 s z (Just x) = z+x toNames :: [Github.IssueLabel] -> [Maybe Double] -toNames = map (toValue . Github.labelName) +toNames = map (toValue . Github.labelName) isValue :: String -> Bool isValue label = (label =~ ("^[0-9]h" :: String)) :: Bool diff --git a/samples/Repos/Commits/GitShow.hs b/samples/Repos/Commits/GitShow.hs index b913cb47..9b5ab8a2 100644 --- a/samples/Repos/Commits/GitShow.hs +++ b/samples/Repos/Commits/GitShow.hs @@ -18,7 +18,7 @@ formatCommit commit = patches where author = Github.gitCommitAuthor gitCommit gitCommit = Github.commitGitCommit commit - patches = + patches = intercalate "\n" $ map Github.filePatch $ Github.commitFiles commit formatAuthor :: Github.GitUser -> String diff --git a/samples/Repos/DeployKeys/ShowDeployKey.hs b/samples/Repos/DeployKeys/ShowDeployKey.hs index 48e06b94..6df4d11c 100644 --- a/samples/Repos/DeployKeys/ShowDeployKey.hs +++ b/samples/Repos/DeployKeys/ShowDeployKey.hs @@ -17,4 +17,3 @@ main = do formatRepoDeployKey :: DK.RepoDeployKey -> String formatRepoDeployKey = show - diff --git a/samples/Search/SearchCode.hs b/samples/Search/SearchCode.hs index c632e2ae..f5b472cb 100644 --- a/samples/Search/SearchCode.hs +++ b/samples/Search/SearchCode.hs @@ -30,4 +30,4 @@ formatCode r = in intercalate "\n" $ map fmt fields where fmt (s,f) = fill 12 (s ++ ":") ++ " " ++ f r fill n s = s ++ replicate n' ' ' - where n' = max 0 (n - length s) + where n' = max 0 (n - length s) diff --git a/samples/Search/SearchRepos.hs b/samples/Search/SearchRepos.hs index 0a558b7e..e09c2bfc 100644 --- a/samples/Search/SearchRepos.hs +++ b/samples/Search/SearchRepos.hs @@ -52,7 +52,7 @@ formatRepo r = where fmt (s,f) = fill 12 (s ++ ":") ++ " " ++ f r orEmpty = fromMaybe "" fill n s = s ++ replicate n' ' ' - where n' = max 0 (n - length s) + where n' = max 0 (n - length s) formatMaybeDate :: Maybe UTCTime -> String diff --git a/samples/Users/Followers/ListFollowers.hs b/samples/Users/Followers/ListFollowers.hs index a5ef346c..dc5df3fe 100644 --- a/samples/Users/Followers/ListFollowers.hs +++ b/samples/Users/Followers/ListFollowers.hs @@ -9,7 +9,7 @@ import qualified GitHub main :: IO () main = do auth <- getAuth - possibleUsers <- GitHub.executeRequestMaybe auth $ GitHub.usersFollowingR "mike-burns" GitHub.FetchAll + possibleUsers <- GitHub.executeRequestMaybe auth $ GitHub.usersFollowingR "mike-burns" GitHub.FetchAll putStrLn $ either (("Error: " <>) . tshow) (foldMap ((<> "\n") . formatUser)) possibleUsers diff --git a/samples/Users/Followers/ListFollowing.hs b/samples/Users/Followers/ListFollowing.hs index 171f2fba..81953aee 100644 --- a/samples/Users/Followers/ListFollowing.hs +++ b/samples/Users/Followers/ListFollowing.hs @@ -9,7 +9,7 @@ import qualified GitHub main :: IO () main = do auth <- getAuth - possibleUsers <- GitHub.executeRequestMaybe auth $ GitHub.usersFollowedByR "mike-burns" GitHub.FetchAll + possibleUsers <- GitHub.executeRequestMaybe auth $ GitHub.usersFollowedByR "mike-burns" GitHub.FetchAll putStrLn $ either (("Error: " <>) . tshow) (foldMap ((<> "\n") . formatUser)) possibleUsers diff --git a/spec/GitHub/ActivitySpec.hs b/spec/GitHub/ActivitySpec.hs index 1f3c82c3..73b044a0 100644 --- a/spec/GitHub/ActivitySpec.hs +++ b/spec/GitHub/ActivitySpec.hs @@ -30,7 +30,7 @@ spec :: Spec spec = do describe "watchersForR" $ do it "works" $ withAuth $ \auth -> do - cs <- executeRequest auth $ watchersForR "phadej" "github" GitHub.FetchAll + cs <- executeRequest auth $ watchersForR "phadej" "github" GitHub.FetchAll cs `shouldSatisfy` isRight V.length (fromRightS cs) `shouldSatisfy` (> 10) describe "myStarredR" $ do diff --git a/spec/GitHub/EventsSpec.hs b/spec/GitHub/EventsSpec.hs index 93f613b1..ae51a1a2 100644 --- a/spec/GitHub/EventsSpec.hs +++ b/spec/GitHub/EventsSpec.hs @@ -29,7 +29,7 @@ spec = do it "returns non empty list of events" $ shouldSucceed $ GitHub.repositoryEventsR "phadej" "github" 1 describe "userEventsR" $ do - it "returns non empty list of events" $ shouldSucceed $ GitHub.userEventsR "phadej" 1 + it "returns non empty list of events" $ shouldSucceed $ GitHub.userEventsR "phadej" 1 where shouldSucceed f = withAuth $ \auth -> do cs <- GitHub.executeRequest auth $ f cs `shouldSatisfy` isRight diff --git a/src/GitHub/Data/Events.hs b/src/GitHub/Data/Events.hs index 8ec6a22d..d7b34528 100644 --- a/src/GitHub/Data/Events.hs +++ b/src/GitHub/Data/Events.hs @@ -23,10 +23,10 @@ data Event = Event deriving (Show, Data, Typeable, Eq, Ord, Generic) instance NFData Event where rnf = genericRnf -instance Binary Event +instance Binary Event instance FromJSON Event where - parseJSON = withObject "Event" $ \obj -> Event + parseJSON = withObject "Event" $ \obj -> Event -- <$> obj .: "id" <$> obj .: "actor" <*> obj .: "created_at" From 9d0f1bee5fe58f7d349bc23ec29d19f6cde0930d Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 19 Apr 2022 18:07:31 +0200 Subject: [PATCH 062/121] fix-whitespace configuration file Fix whitespace violations in files as defined by fix-whitespace.yaml via $ fix-whitespace --- fix-whitespace.yaml | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 fix-whitespace.yaml diff --git a/fix-whitespace.yaml b/fix-whitespace.yaml new file mode 100644 index 00000000..80795e01 --- /dev/null +++ b/fix-whitespace.yaml @@ -0,0 +1,61 @@ +# This file contains the project-specific settings for `fix-whitespace` +# +# (get it with `cabal install fix-whitespace`) +# +# a tiny, but useful tool to: +# +# * Remove trailing whitespace. +# * Remove trailing lines containing nothing but whitespace. +# * Ensure that the file ends in a newline character. +# +# By default, fix-whitespace checks every directory under the current working +# directory but no files. This program should be placed under a text-based +# project. +# +# For directories, +# +# 1) excluded-dirs is a black-list of directories, +# 2) included-dirs is a white-list of excluded-dirs +# +# For files, +# +# 3) included-files is a white-list of files, +# 4) excluded-files is a black-list of included-files. +# +# The extended glob pattern can be used to specify file/direcotory names. +# For details, see http://hackage.haskell.org/package/filemanip-0.3.6.3/docs/System-FilePath-GlobPattern.html +# + +excluded-dirs: + - .git + - .stack-work + - "dist*" + - fixtures + +included-dirs: + +# Every matched filename is included unless it is matched by excluded-files. +included-files: + - .authorspellings + - .gitignore + - LICENSE + - cabal.haskell-ci + - cabal.project + - cabal.project.local + - "*.cabal" + - "*.css" + - "*.example" + - "*.hs" + - "*.hs-boot" + - "*.html" + - "*.js" + - "*.json" + - "*.lhs" + - "*.md" + - "*.rst" + - "*.sh" + - "*.txt" + - "*.yaml" + - "*.yml" + +excluded-files: From 90a70c3722dfdd4f916d3ab3616f292953a8f664 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 19 Apr 2022 18:28:19 +0200 Subject: [PATCH 063/121] CHANGELOG & .cabal: move phadej -> haskell-github Also: cosmetical fixes --- CHANGELOG.md | 208 +++++++++++++++++++++++++-------------------------- github.cabal | 6 +- 2 files changed, 107 insertions(+), 107 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10cc9b18..b7bcbc47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,49 +1,49 @@ ## Changes for 0.27 -- Add vector of SimpleTeam in "requested_teams" field of PullRequest - [#453](https://github.com/phadej/github/pull/453) +- Add vector of `SimpleTeam` in "requested_teams" field of `PullRequest` + [#453](https://github.com/haskell-github/github/pull/453) - Add endpoint to create gist - [#455](https://github.com/phadej/github/pull/455) -- Update RepoWebhookEvent - [#461](https://github.com/phadej/github/pull/461) -- PullRequest Reviews may not have submitted_at field - [#450](https://github.com/phadej/github/pull/450) + [#455](https://github.com/haskell-github/github/pull/455) +- Update `RepoWebhookEvent` + [#461](https://github.com/haskell-github/github/pull/461) +- `PullRequest` Reviews may not have submitted_at field + [#450](https://github.com/haskell-github/github/pull/450) ## Changes for 0.26 -- Generalize PagedQuery to allow its reuse by preview github APIs - [#439](https://github.com/phadej/github/pull/439) +- Generalize `PagedQuery` to allow its reuse by preview github APIs + [#439](https://github.com/haskell-github/github/pull/439) - Add endpoint for listing organizations outside collaborators - [#445](https://github.com/phadej/github/pull/445) + [#445](https://github.com/haskell-github/github/pull/445) - Add endpoint for users search - [#444](https://github.com/phadej/github/pull/444) -- Make repoWebhookResponseStatus optional - [#436](https://github.com/phadej/github/pull/436) + [#444](https://github.com/haskell-github/github/pull/444) +- Make `repoWebhookResponseStatus` optional + [#436](https://github.com/haskell-github/github/pull/436) - Teams improvements - [#417](https://github.com/phadej/github/pull/417) -- Add deleteReference endpoint - [#388](https://github.com/phadej/github/pull/388) + [#417](https://github.com/haskell-github/github/pull/417) +- Add `deleteReference` endpoint + [#388](https://github.com/haskell-github/github/pull/388) ## Changes for 0.25 - Add `executeRequestWithMgrAndRes` - [#421](https://github.com/phadej/github/pull/421) + [#421](https://github.com/haskell-github/github/pull/421) - Add `limitsFromHttpResponse` - [#421](https://github.com/phadej/github/pull/421) + [#421](https://github.com/haskell-github/github/pull/421) - Add label descriptions - [#418](https://github.com/phadej/github/pull/418) + [#418](https://github.com/haskell-github/github/pull/418) - Add "draft" option to mergeable state - [#431](https://github.com/phadej/github/pull/431) -- Use IssueNumber in editIssueR and issueR - [#429](https://github.com/phadej/github/pull/429) + [#431](https://github.com/haskell-github/github/pull/431) +- Use `IssueNumber` in `editIssueR` and `issueR` + [#429](https://github.com/haskell-github/github/pull/429) - Manage orgs in GitHub Enterprise - [#420](https://github.com/phadej/github/pull/420) + [#420](https://github.com/haskell-github/github/pull/420) - Add support for collaborator permission endpoint - [#425](https://github.com/phadej/github/pull/425) + [#425](https://github.com/haskell-github/github/pull/425) - Add support for the comment reply endpoint - [#424](https://github.com/phadej/github/pull/424) + [#424](https://github.com/haskell-github/github/pull/424) - Organise exports in `GitHub` - [#430](https://github.com/phadej/github/pull/430) + [#430](https://github.com/haskell-github/github/pull/430) ## Changes for 0.24 @@ -53,122 +53,122 @@ into `... -> IO (Either Error res)` (i.e. n-ary `executeRequest`). With that in place drop `.. -> IO (Either Error res)` functions. This reduces symbol bloat in the library. -[#415](https://github.com/phadej/github/pull/415) +[#415](https://github.com/haskell-github/github/pull/415) - Remove double `withOpenSSL` - [#414](https://github.com/phadej/github/pull/414) + [#414](https://github.com/haskell-github/github/pull/414) - Pull requests reviews API uses issue number - [#409](https://github.com/phadej/github/pull/409) + [#409](https://github.com/haskell-github/github/pull/409) - Update `Repo`, `NewRepo` and `EditRepo` data types - [#407](https://github.com/phadej/github/pull/407) + [#407](https://github.com/haskell-github/github/pull/407) ## Changes for 0.23 - Escape URI paths - [#404](https://github.com/phadej/github/pull/404) -- Add OwnerBot to OwnerType - [#399](https://github.com/phadej/github/pull/399) -- Make File.fileSha optional - [#392](https://github.com/phadej/github/pull/392) + [#404](https://github.com/haskell-github/github/pull/404) +- Add `OwnerBot` to `OwnerType` + [#399](https://github.com/haskell-github/github/pull/399) +- Make `File.fileSha` optional + [#392](https://github.com/haskell-github/github/pull/392) - Update User-Agent to contain up to date version - [#403](https://github.com/phadej/github/pull/403) - [#394](https://github.com/phadej/github/pull/394) + [#403](https://github.com/haskell-github/github/pull/403) + [#394](https://github.com/haskell-github/github/pull/394) ## Changes for 0.22 - Type-class for various auth methods - [#365](https://github.com/phadej/github/pull/365) + [#365](https://github.com/haskell-github/github/pull/365) - Throw on non-200 responses - [#350](https://github.com/phadej/github/pull/350) + [#350](https://github.com/haskell-github/github/pull/350) - Add extension point for (preview) media types - [#370](https://github.com/phadej/github/pull/370) + [#370](https://github.com/haskell-github/github/pull/370) - Add missing webhook event types - [#359](https://github.com/phadej/github/pull/359) + [#359](https://github.com/haskell-github/github/pull/359) - Add invitation endpoint - [#360](https://github.com/phadej/github/pull/360) + [#360](https://github.com/haskell-github/github/pull/360) - Add notifications endpoints - [#324](https://github.com/phadej/github/pull/324) + [#324](https://github.com/haskell-github/github/pull/324) - Add ssh keys endpoints - [#363](https://github.com/phadej/github/pull/365) + [#363](https://github.com/haskell-github/github/pull/365) - Case insensitive enum parsing - [#373](https://github.com/phadej/github/pull/373) + [#373](https://github.com/haskell-github/github/pull/373) - Don't try parse unitary responses - [#377](https://github.com/phadej/github/issues/377) + [#377](https://github.com/haskell-github/github/issues/377) - Update dependencies - [#364](https://github.com/phadej/github/pull/364) - [#368](https://github.com/phadej/github/pull/368) - [#369](https://github.com/phadej/github/pull/369) + [#364](https://github.com/haskell-github/github/pull/364) + [#368](https://github.com/haskell-github/github/pull/368) + [#369](https://github.com/haskell-github/github/pull/369) - Documentation improvements - [#357](https://github.com/phadej/github/pull/357) + [#357](https://github.com/haskell-github/github/pull/357) ## Changes for 0.21 - Refactor `Request` type. - [#349](https://github.com/phadej/github/pull/349) + [#349](https://github.com/haskell-github/github/pull/349) - Allow `http-client-0.6` - [#344](https://github.com/phadej/github/pull/344) + [#344](https://github.com/haskell-github/github/pull/344) - Change to use `cryptohash-sha1` (`cryptohash` was used before) -- Add Create milestone endponts - [#337](https://github.com/phadej/github/pull/337) -- Make fileBlobUrl and fileRawUrl are optional - [#339](https://github.com/phadej/github/issues/339) - [#340](https://github.com/phadej/github/pull/340) -- Add organizationsR to request user organizations - [#345](https://github.com/phadej/github/pull/345) -- Add updateMilestoneR, deleteMilestoneR - [#338](https://github.com/phadej/github/pull/338) -- Allow multiple assignees in NewIssue and EditIssue - [#336](https://github.com/phadej/github/pull/336) +- Add Create milestone endpoints + [#337](https://github.com/haskell-github/github/pull/337) +- Make `fileBlobUrl` and `fileRawUrl` optional + [#339](https://github.com/haskell-github/github/issues/339) + [#340](https://github.com/haskell-github/github/pull/340) +- Add `organizationsR` to request user organizations + [#345](https://github.com/haskell-github/github/pull/345) +- Add `updateMilestoneR`, `deleteMilestoneR` + [#338](https://github.com/haskell-github/github/pull/338) +- Allow multiple assignees in `NewIssue` and `EditIssue` + [#336](https://github.com/haskell-github/github/pull/336) - Add `pullRequestPatchR` and `pullRequestDiffR` - [#325](https://github.com/phadej/github/pull/325) + [#325](https://github.com/haskell-github/github/pull/325) ## Changes for 0.20 - Add ratelimit endpoint - [#315](https://github.com/phadej/github/pull/315) + [#315](https://github.com/haskell-github/github/pull/315) - Add some deployment endoints - [#330](https://github.com/phadej/github/pull/330) + [#330](https://github.com/haskell-github/github/pull/330) - Add webhook installation events - [#329](https://github.com/phadej/github/pull/330) -- Tigthen lower bounds (also remove aeson-compat dep) - [#332](https://github.com/phadej/github/pull/332) + [#329](https://github.com/haskell-github/github/pull/330) +- Tighten lower bounds (also remove `aeson-compat` dep) + [#332](https://github.com/haskell-github/github/pull/332) ## Changes for 0.19 - Fix issue event type enumeration - [#301](https://github.com/phadej/github/issues/301) -- Include label info in `IssseEvent` - [#302](https://github.com/phadej/github/issues/302) + [#301](https://github.com/haskell-github/github/issues/301) +- Include label info in `IssueEvent` + [#302](https://github.com/haskell-github/github/issues/302) - Fix `ShowRepo` example - [#306](https://github.com/phadej/github/pull/306) + [#306](https://github.com/haskell-github/github/pull/306) - Add "Get archive link" API - [#307](https://github.com/phadej/github/pull/307) -- Make "repo" in PullRequestCommit nullable (repository can be gone) - [#311](https://github.com/phadej/github/pull/311) + [#307](https://github.com/haskell-github/github/pull/307) +- Make "repo" in `PullRequestCommit` nullable (repository can be gone) + [#311](https://github.com/haskell-github/github/pull/311) - Add read-only emails endpoint - [#313](https://github.com/phadej/github/pull/313) + [#313](https://github.com/haskell-github/github/pull/313) - Organisation membership API - [#312](https://github.com/phadej/github/pull/312) -- Fix isPullRequestMerged and other boolean responses - [#312](https://github.com/phadej/github/pull/312) + [#312](https://github.com/haskell-github/github/pull/312) +- Fix `isPullRequestMerged` and other boolean responses + [#312](https://github.com/haskell-github/github/pull/312) - Add `behind` pull request mergeable state - [#308](https://github.com/phadej/github/pull/308) + [#308](https://github.com/haskell-github/github/pull/308) - Add list organisation invitations endpoint ## Changes for 0.18 - Endpoints for deleting issue comments. - [#294](https://github.com/phadej/github/pull/294) + [#294](https://github.com/haskell-github/github/pull/294) - Endpoints for (un)starring gists. - [#296](https://github.com/phadej/github/pull/296) + [#296](https://github.com/haskell-github/github/pull/296) - Add `archived` field to `Repo`. - [#298](https://github.com/phadej/github/pull/298) + [#298](https://github.com/haskell-github/github/pull/298) - Update dependencies. - [#295](https://github.com/phadej/github/pull/295) + [#295](https://github.com/haskell-github/github/pull/295) - Add Statuses endpoints. - [#268](https://github.com/phadej/github/pull/268) + [#268](https://github.com/haskell-github/github/pull/268) - Add requested reviewers field to pull request records. - [#292](https://github.com/phadej/github/pull/292) + [#292](https://github.com/haskell-github/github/pull/292) ## Changes for 0.17.0 @@ -184,7 +184,7 @@ This reduces symbol bloat in the library. - Supports newest versions of dependencies - user events - release endpoints -- forkExistingRepo +- `forkExistingRepo` ## Changes for 0.15.0 @@ -197,16 +197,16 @@ This reduces symbol bloat in the library. - Add `HeaderQuery` to `Request` - Add `Hashable Auth` instance - Add `mkUserId`, `mkUserName`, `fromUserId`, `fromOrganizationId` -- Add 'userIssuesR' -- Add 'organizationIssuesR' +- Add `userIssuesR` +- Add `organizationIssuesR` - Make `teamName :: Text` amnd `teamSlug :: Name Team` in both: `Team` and `SimpleTeam` -- Refactor 'Request' structure +- Refactor `Request` structure - Added multiple issue assignees - Preliminary support for repository events: `repositoryEventsR` - Support for adding repository permissions to the team -- Remove 'simpleUserType', it was always the same. +- Remove `simpleUserType`, it was always the same. -See [git commit summary](https://github.com/phadej/github/compare/v0.14.1...v0.15.0) +See [git commit summary](https://github.com/haskell-github/github/compare/v0.14.1...v0.15.0) ## Changes for 0.14.1 @@ -229,23 +229,23 @@ Large API changes: ## Changes for 0.5.0: -* OAuth. +* `OAuth`. * New function: `Github.Repos.organizationRepo`, to get the repo for a specific organization. * Introduce a new `newRepoAutoInit` flag to `NewRepo`, for whether to initialize a repo while creating it. -* Relax the attoparsec version requirements. +* Relax the `attoparsec` version requirements. * The above by [John Wiegley](https://github.com/jwiegley). ## Changes for 0.4.1: -* Stop using the uri package. -* Use aeson version 0.6.1.0. -* Use attoparsec version 0.10.3.0. -* Use http-conduit over 1.8. -* Use unordered-containers between 0.2 and 0.3. +* Stop using the `uri` package. +* Use `aeson` version 0.6.1.0. +* Use `attoparsec` version 0.10.3.0. +* Use `http-conduit` over 1.8. +* Use `unordered-containers` between 0.2 and 0.3. ## Changes for 0.4.0: -* Use http-conduit version 1.4.1.10. +* Use `http-conduit` version 1.4.1.10. ## Changes for 0.3.0: @@ -259,13 +259,13 @@ Large API changes: ## Changes for 0.2.1: -* Expand the unordered-containers dependency to anything in 0.1.x . +* Expand the `unordered-containers` dependency to anything in 0.1.x . ## Changes for 0.2.0: * `milestoneDueOn` and `repoLanguage` are now `Maybe` types. -* Introduce `GithubOwner` as the sum type for a `GithubUser` or `GithubOrganization`. Everything that once produced a `GithubUser` now produces a `GithubOwner`. All record accessors have changed their names -* Similar to `GithubOwner`, introduce `DetailedOwner`, which can be a `DetailedUser` or a `DetailedOrganization`. All record accessors have changed their names +* Introduce `GithubOwner` as the sum type for a `GithubUser` or `GithubOrganization`. Everything that once produced a `GithubUser` now produces a `GithubOwner`. All record accessors have changed their names. +* Similar to `GithubOwner`, introduce `DetailedOwner`, which can be a `DetailedUser` or a `DetailedOrganization`. All record accessors have changed their names. * An `HTTPConnectionError` now composes `SomeException` instead of `IOException`. All exceptions raised by the underlying http-conduit library are encapulated there. * The `githubIssueClosedBy` function now produces a `Maybe GithubOwner`. * Remove the Blobs API, as it is broken upstream. diff --git a/github.cabal b/github.cabal index 04cb2c9a..670a3d2d 100644 --- a/github.cabal +++ b/github.cabal @@ -18,13 +18,13 @@ description: > possibleUser <- GH.github' GH.userInfoForR "phadej" > print possibleUser . - For more of an overview please see the README: + For more of an overview please see the README: license: BSD3 license-file: LICENSE author: Mike Burns, John Wiegley, Oleg Grenrus maintainer: Oleg Grenrus -homepage: https://github.com/phadej/github +homepage: https://github.com/haskell-github/github build-type: Simple copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus @@ -48,7 +48,7 @@ extra-source-files: source-repository head type: git - location: git://github.com/phadej/github.git + location: git://github.com/haskell-github/github.git flag openssl description: "Use http-client-openssl" From 00a166f286fa296d14fb1a5f74cb0b6ed464a532 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 19 Apr 2022 18:30:01 +0200 Subject: [PATCH 064/121] CONTRIBUTING: add testing requirement --- CONTRIBUTING.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8bb941ef..dc10c361 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,13 +15,24 @@ For example: ```haskell -- | Get your current rate limit status. --- +-- rateLimitR :: Request k RateLimit rateLimitR = query ["rate_limit"] [] ``` Also re-export endpoints from the top `GitHub` module. *Note:* only `R` variants, not `IO`. +Testing +------- + +When adding new functionality, cover it by a test case in: + + spec/ + +or a demonstration added to: + + samples/github-samples.cabal + Miscellaneous ------------- From ebf466438a61297c6a38f725edb7ec1f4b950804 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 30 Apr 2022 09:08:50 +0200 Subject: [PATCH 065/121] CHANGELOG: add release dates and authors --- CHANGELOG.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7bcbc47..1f45068e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Changes for 0.27 +_2021-10-10, Oleg Grenrus_ + - Add vector of `SimpleTeam` in "requested_teams" field of `PullRequest` [#453](https://github.com/haskell-github/github/pull/453) - Add endpoint to create gist @@ -11,6 +13,8 @@ ## Changes for 0.26 +_2020-05-26, Oleg Grenrus_ + - Generalize `PagedQuery` to allow its reuse by preview github APIs [#439](https://github.com/haskell-github/github/pull/439) - Add endpoint for listing organizations outside collaborators @@ -26,6 +30,8 @@ ## Changes for 0.25 +_2020-02-18, Oleg Grenrus_ + - Add `executeRequestWithMgrAndRes` [#421](https://github.com/haskell-github/github/pull/421) - Add `limitsFromHttpResponse` @@ -47,6 +53,8 @@ ## Changes for 0.24 +_2019-11-27, Oleg Grenrus_ + **Major change**: Introduce `github` n-ary combinator to hoist `... -> Request rw res` into `... -> IO (Either Error res)` (i.e. n-ary `executeRequest`). @@ -64,6 +72,8 @@ This reduces symbol bloat in the library. ## Changes for 0.23 +_2019-10-01, Oleg Grenrus_ + - Escape URI paths [#404](https://github.com/haskell-github/github/pull/404) - Add `OwnerBot` to `OwnerType` @@ -76,6 +86,8 @@ This reduces symbol bloat in the library. ## Changes for 0.22 +_2019-05-31, Oleg Grenrus_ + - Type-class for various auth methods [#365](https://github.com/haskell-github/github/pull/365) - Throw on non-200 responses @@ -103,6 +115,8 @@ This reduces symbol bloat in the library. ## Changes for 0.21 +_2019-02-18, Oleg Grenrus_ + - Refactor `Request` type. [#349](https://github.com/haskell-github/github/pull/349) - Allow `http-client-0.6` @@ -124,6 +138,8 @@ This reduces symbol bloat in the library. ## Changes for 0.20 +_2018-09-26, Oleg Grenrus_ + - Add ratelimit endpoint [#315](https://github.com/haskell-github/github/pull/315) - Add some deployment endoints @@ -135,6 +151,8 @@ This reduces symbol bloat in the library. ## Changes for 0.19 +_2018-02-19, Oleg Grenrus_ + - Fix issue event type enumeration [#301](https://github.com/haskell-github/github/issues/301) - Include label info in `IssueEvent` @@ -157,6 +175,8 @@ This reduces symbol bloat in the library. ## Changes for 0.18 +_2017-11-10, Oleg Grenrus_ + - Endpoints for deleting issue comments. [#294](https://github.com/haskell-github/github/pull/294) - Endpoints for (un)starring gists. @@ -172,6 +192,8 @@ This reduces symbol bloat in the library. ## Changes for 0.17.0 +_2017-09-26, Oleg Grenrus_ + - Add `Ord Request` instance - Repository contents - Repository starring endpoints @@ -179,6 +201,8 @@ This reduces symbol bloat in the library. ## Changes for 0.16.0 +_2017-07-24, Oleg Grenrus_ + - Add support for `mergeable_state = "blocked".` - Fix HTTP status code of merge PR - Supports newest versions of dependencies @@ -188,6 +212,8 @@ This reduces symbol bloat in the library. ## Changes for 0.15.0 +_2016-11-04, Oleg Grenrus_ + - Reworked `PullRequest` (notably `pullRequestsFor`) - Reworked PR and Issue filtering - GHC-8.0.1 support @@ -210,6 +236,8 @@ See [git commit summary](https://github.com/haskell-github/github/compare/v0.14. ## Changes for 0.14.1 +_2016-02-02, Oleg Grenrus_ + - Add `membersOfWithR`, `listTeamMembersR` - Add related enums: `OrgMemberFilter`, `OrgMemberRole`, `TeamMemberRole` - Add `Enum` and `Bounded` instances to `Privacy`, `Permission`, @@ -218,6 +246,8 @@ See [git commit summary](https://github.com/haskell-github/github/compare/v0.14. ## Changes for 0.14.0 +_2016-01-25, Oleg Grenrus_ + Large API changes: - Use `Text` and `Vector` in place of `String` and `[]`. @@ -227,8 +257,30 @@ Large API changes: - Add `Binary` instances for all data - `GithubOwner` is a `newtype` of `Either User Organization`. There's still `SimpleOwner`. +## Releases without changelog + +| Version | Date | Uploader | +|---|---|---| +| __0.13.2__ | _2015-04-26_ | _John Wiegley_ | +| __0.13.1__ | _2014-12-01_ | _César López-Natarén_ | +| __0.13__ | _2014-11-09_ | _César López-Natarén_ | +| __0.12__ | _2014-11-09_ | _César López-Natarén_ | +| __0.11.1__ | _2014-09-07_ | _César López-Natarén_ | +| __0.11.0__ | _2014-08-25_ | _César López-Natarén_ | +| __0.10.0__ | _2014-08-18_ | _César López-Natarén_ | +| __0.9__ | _2014-07-31_ | _John Wiegley_ | +| __0.8__ | _2014-05-02_ | _John Wiegley_ | +| __0.7.4__ | _2014-01-22_ | _John Wiegley_ | +| __0.7.3__ | _2013-12-21_ | _John Wiegley_ | +| __0.7.2__ | _2013-12-02_ | _John Wiegley_ | +| __0.7.1__ | _2013-08-08_ | _John Wiegley_ | +| __0.7.0__ | _2013-04-26_ | _John Wiegley_ | +| __0.6.0__ | _2013-04-12_ | _John Wiegley_ | + ## Changes for 0.5.0: +_2013-02-05, Mike Burns_ + * `OAuth`. * New function: `Github.Repos.organizationRepo`, to get the repo for a specific organization. * Introduce a new `newRepoAutoInit` flag to `NewRepo`, for whether to initialize a repo while creating it. @@ -237,6 +289,8 @@ Large API changes: ## Changes for 0.4.1: +_2013-01-14, Mike Burns_ + * Stop using the `uri` package. * Use `aeson` version 0.6.1.0. * Use `attoparsec` version 0.10.3.0. @@ -245,10 +299,14 @@ Large API changes: ## Changes for 0.4.0: +_2012-06-26, Mike Burns_ + * Use `http-conduit` version 1.4.1.10. ## Changes for 0.3.0: +_2012-06-10, Mike Burns_ + * Re-instantiate the Blobs API. * `repoDescription1` and `repoPushedAt` are a `Maybe GithubDate`. * Add `deleteRepo`, `editRepo`, and `createRepo`. @@ -259,10 +317,14 @@ Large API changes: ## Changes for 0.2.1: +_2012-02-16, Mike Burns_ + * Expand the `unordered-containers` dependency to anything in 0.1.x . ## Changes for 0.2.0: +_2012-02-15, Mike Burns_ + * `milestoneDueOn` and `repoLanguage` are now `Maybe` types. * Introduce `GithubOwner` as the sum type for a `GithubUser` or `GithubOrganization`. Everything that once produced a `GithubUser` now produces a `GithubOwner`. All record accessors have changed their names. * Similar to `GithubOwner`, introduce `DetailedOwner`, which can be a `DetailedUser` or a `DetailedOrganization`. All record accessors have changed their names. From cbd8d2b6fa33eace60a3a3accbed3823f9e70564 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 30 Apr 2022 09:44:05 +0200 Subject: [PATCH 066/121] Allow text-2.0 --- cabal.project | 8 ++------ github.cabal | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cabal.project b/cabal.project index b9ac7eb6..3e6d3d45 100644 --- a/cabal.project +++ b/cabal.project @@ -4,12 +4,8 @@ packages: samples optimization: False tests: True -constraints: hashable >=1.3 -constraints: semigroups ^>=0.19 - constraints: github +openssl constraints: github-samples +openssl -allow-newer: deepseq-generics-0.2.0.0:base -allow-newer: deepseq-generics-0.2.0.0:ghc-prim -allow-newer: HsOpenSSL:bytestring +constraints: text >=2 +allow-newer: *:text diff --git a/github.cabal b/github.cabal index 670a3d2d..868629d4 100644 --- a/github.cabal +++ b/github.cabal @@ -171,7 +171,7 @@ library , containers >=0.5.5.1 && <0.7 , deepseq >=1.3.0.2 && <1.5 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.3 - , text >=1.2.0.6 && <1.3 + , text >=1.2.0.6 && <2.1 , time-compat >=1.9.2.2 && <1.10 , transformers >=0.3.0.0 && <0.6 From f371051bce54b702268029dff6a9a03783f11c91 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 30 Apr 2022 10:19:22 +0200 Subject: [PATCH 067/121] Use repo haskell-github/github in specs and samples Repo moved from phadej/github. --- samples/Activity/Starring/StarRepo.hs | 2 +- samples/Activity/Starring/UnstarRepo.hs | 2 +- samples/Operational/Operational.hs | 2 +- spec/GitHub/ActivitySpec.hs | 2 +- spec/GitHub/CommitsSpec.hs | 8 ++++---- spec/GitHub/EventsSpec.hs | 2 +- spec/GitHub/IssuesSpec.hs | 4 ++-- spec/GitHub/PullRequestReviewsSpec.hs | 2 +- spec/GitHub/PullRequestsSpec.hs | 8 ++++---- spec/GitHub/ReposSpec.hs | 6 +++--- spec/GitHub/SearchSpec.hs | 2 +- spec/GitHub/UsersSpec.hs | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/samples/Activity/Starring/StarRepo.hs b/samples/Activity/Starring/StarRepo.hs index 452aaf7b..1174c380 100644 --- a/samples/Activity/Starring/StarRepo.hs +++ b/samples/Activity/Starring/StarRepo.hs @@ -8,7 +8,7 @@ import qualified Data.Text.IO as T main :: IO () main = do - let owner = "phadej" + let owner = "haskell-github" repo = "github" result <- GH.starRepo (GH.OAuth "your-token") (GH.mkOwnerName owner) (GH.mkRepoName repo) diff --git a/samples/Activity/Starring/UnstarRepo.hs b/samples/Activity/Starring/UnstarRepo.hs index 29d68dd1..3ecfe196 100644 --- a/samples/Activity/Starring/UnstarRepo.hs +++ b/samples/Activity/Starring/UnstarRepo.hs @@ -8,7 +8,7 @@ import qualified Data.Text.IO as T main :: IO () main = do - let owner = "phadej" + let owner = "haskell-github" repo = "github" result <- GH.unstarRepo (GH.OAuth "your-token") (GH.mkOwnerName owner) (GH.mkRepoName repo) diff --git a/samples/Operational/Operational.hs b/samples/Operational/Operational.hs index 4e669ff4..cbfc9fb4 100644 --- a/samples/Operational/Operational.hs +++ b/samples/Operational/Operational.hs @@ -47,7 +47,7 @@ main = GH.withOpenSSL $ do script :: Program R (GH.Owner, GH.Limits) script = do - repo <- githubRequest $ GH.repositoryR "phadej" "github" + repo <- githubRequest $ GH.repositoryR "haskell-github" "github" owner <- githubRequest $ GH.ownerInfoForR (GH.simpleOwnerLogin . GH.repoOwner $ repo) rl <- githubRequest GH.rateLimitR return (owner, GH.rateLimitCore rl) diff --git a/spec/GitHub/ActivitySpec.hs b/spec/GitHub/ActivitySpec.hs index 73b044a0..43b3c234 100644 --- a/spec/GitHub/ActivitySpec.hs +++ b/spec/GitHub/ActivitySpec.hs @@ -30,7 +30,7 @@ spec :: Spec spec = do describe "watchersForR" $ do it "works" $ withAuth $ \auth -> do - cs <- executeRequest auth $ watchersForR "phadej" "github" GitHub.FetchAll + cs <- executeRequest auth $ watchersForR "haskell-github" "github" GitHub.FetchAll cs `shouldSatisfy` isRight V.length (fromRightS cs) `shouldSatisfy` (> 10) describe "myStarredR" $ do diff --git a/spec/GitHub/CommitsSpec.hs b/spec/GitHub/CommitsSpec.hs index 5bf2d6a0..97f8c386 100644 --- a/spec/GitHub/CommitsSpec.hs +++ b/spec/GitHub/CommitsSpec.hs @@ -30,13 +30,13 @@ spec :: Spec spec = do describe "commitsFor" $ do it "works" $ withAuth $ \auth -> do - cs <- github auth commitsForR "phadej" "github" FetchAll + cs <- github auth commitsForR "haskell-github" "github" FetchAll cs `shouldSatisfy` isRight V.length (fromRightS cs) `shouldSatisfy` (> 300) -- Page size is 30, so we get 60 commits it "limits the response" $ withAuth $ \auth -> do - cs <- github auth commitsForR "phadej" "github" (FetchAtLeast 40) + cs <- github auth commitsForR "haskell-github" "github" (FetchAtLeast 40) cs `shouldSatisfy` isRight let cs' = fromRightS cs V.length cs' `shouldSatisfy` (< 70) @@ -45,12 +45,12 @@ spec = do describe "diff" $ do it "works" $ withAuth $ \auth -> do - cs <- github auth commitsForR "phadej" "github" (FetchAtLeast 30) + cs <- github auth commitsForR "haskell-github" "github" (FetchAtLeast 30) cs `shouldSatisfy` isRight let commits = take 10 . V.toList . fromRightS $ cs let pairs = zip commits $ drop 1 commits forM_ pairs $ \(a, b) -> do - d <- github auth diffR "phadej" "github" (commitSha a) (commitSha b) + d <- github auth diffR "haskell-github" "github" (commitSha a) (commitSha b) d `shouldSatisfy` isRight it "issue #155" $ withAuth $ \auth -> do diff --git a/spec/GitHub/EventsSpec.hs b/spec/GitHub/EventsSpec.hs index ae51a1a2..fee7f50e 100644 --- a/spec/GitHub/EventsSpec.hs +++ b/spec/GitHub/EventsSpec.hs @@ -27,7 +27,7 @@ spec :: Spec spec = do describe "repositoryEventsR" $ do it "returns non empty list of events" $ shouldSucceed $ - GitHub.repositoryEventsR "phadej" "github" 1 + GitHub.repositoryEventsR "haskell-github" "github" 1 describe "userEventsR" $ do it "returns non empty list of events" $ shouldSucceed $ GitHub.userEventsR "phadej" 1 where shouldSucceed f = withAuth $ \auth -> do diff --git a/spec/GitHub/IssuesSpec.hs b/spec/GitHub/IssuesSpec.hs index 2ed08278..2a7f5e7b 100644 --- a/spec/GitHub/IssuesSpec.hs +++ b/spec/GitHub/IssuesSpec.hs @@ -41,10 +41,10 @@ spec = do describe "issueR" $ do it "fetches issue #428" $ withAuth $ \auth -> do resIss <- GitHub.executeRequest auth $ - GitHub.issueR "phadej" "github" (GitHub.IssueNumber 428) + GitHub.issueR "haskell-github" "github" (GitHub.IssueNumber 428) resIss `shouldSatisfy` isRight where repos = [ ("thoughtbot", "paperclip") - , ("phadej", "github") + , ("haskell-github", "github") ] diff --git a/spec/GitHub/PullRequestReviewsSpec.hs b/spec/GitHub/PullRequestReviewsSpec.hs index 8721efc9..1aed07e4 100644 --- a/spec/GitHub/PullRequestReviewsSpec.hs +++ b/spec/GitHub/PullRequestReviewsSpec.hs @@ -29,4 +29,4 @@ spec = do cs `shouldSatisfy` isRight where prs = - [("phadej", "github", IssueNumber 268)] + [("haskell-github", "github", IssueNumber 268)] diff --git a/spec/GitHub/PullRequestsSpec.hs b/spec/GitHub/PullRequestsSpec.hs index 7a49bc97..05945d01 100644 --- a/spec/GitHub/PullRequestsSpec.hs +++ b/spec/GitHub/PullRequestsSpec.hs @@ -47,7 +47,7 @@ spec = do describe "pullRequestPatchR" $ it "works" $ withAuth $ \auth -> do Right patch <- GH.executeRequest auth $ - GH.pullRequestPatchR "phadej" "github" (GH.IssueNumber 349) + GH.pullRequestPatchR "haskell-github" "github" (GH.IssueNumber 349) head (LBS8.lines patch) `shouldBe` "From c0e4ad33811be82e1f72ee76116345c681703103 Mon Sep 17 00:00:00 2001" describe "decoding pull request payloads" $ do @@ -74,21 +74,21 @@ spec = do describe "checking if a pull request is merged" $ do it "works" $ withAuth $ \auth -> do - b <- GH.executeRequest auth $ GH.isPullRequestMergedR "phadej" "github" (GH.IssueNumber 14) + b <- GH.executeRequest auth $ GH.isPullRequestMergedR "haskell-github" "github" (GH.IssueNumber 14) b `shouldSatisfy` isRight fromRightS b `shouldBe` True describe "Draft Pull Request" $ do it "works" $ withAuth $ \auth -> do cs <- GH.executeRequest auth $ - draftPullRequestsForR "phadej" "github" opts GH.FetchAll + draftPullRequestsForR "haskell-github" "github" opts GH.FetchAll cs `shouldSatisfy` isRight where repos = [ ("thoughtbot", "paperclip") - , ("phadej", "github") + , ("haskell-github", "github") ] opts = GH.stateClosed diff --git a/spec/GitHub/ReposSpec.hs b/spec/GitHub/ReposSpec.hs index a08ca00d..45c32415 100644 --- a/spec/GitHub/ReposSpec.hs +++ b/spec/GitHub/ReposSpec.hs @@ -29,10 +29,10 @@ spec :: Spec spec = do describe "repositoryR" $ do it "works" $ withAuth $ \auth -> do - er <- github auth repositoryR "phadej" "github" + er <- github auth repositoryR "haskell-github" "github" er `shouldSatisfy` isRight let Right r = er - -- https://github.com/phadej/github/pull/219 + -- https://github.com/haskell-github/github/pull/219 repoDefaultBranch r `shouldBe` Just "master" describe "currentUserRepos" $ do @@ -47,6 +47,6 @@ spec = do describe "languagesFor'" $ do it "works" $ withAuth $ \auth -> do - ls <- github auth languagesForR "phadej" "github" + ls <- github auth languagesForR "haskell-github" "github" ls `shouldSatisfy` isRight fromRightS ls `shouldSatisfy` HM.member "Haskell" diff --git a/spec/GitHub/SearchSpec.hs b/spec/GitHub/SearchSpec.hs index f82a2051..23c6b7a9 100644 --- a/spec/GitHub/SearchSpec.hs +++ b/spec/GitHub/SearchSpec.hs @@ -54,7 +54,7 @@ spec = do issueState issue2 `shouldBe` StateOpen it "performs an issue search via the API" $ withAuth $ \auth -> do - let query = "Decouple in:title repo:phadej/github created:<=2015-12-01" + let query = "Decouple in:title repo:haskell-github/github created:<=2015-12-01" issues <- fmap (searchResultResults . fromRightS) <$> github auth $ searchIssuesR query 5 length issues `shouldBe` 1 issueId (V.head issues) `shouldBe` mkId (Proxy :: Proxy Issue) 119694665 diff --git a/spec/GitHub/UsersSpec.hs b/spec/GitHub/UsersSpec.hs index abb2a882..0b1913f5 100644 --- a/spec/GitHub/UsersSpec.hs +++ b/spec/GitHub/UsersSpec.hs @@ -67,7 +67,7 @@ spec = do (userLogin . fromLeftS . fromOwner . fromRightS $ b) `shouldBe` "phadej" describe "userInfoCurrentR" $ do - it "returns information about the autenticated user" $ withAuth $ \auth -> do + it "returns information about the authenticated user" $ withAuth $ \auth -> do userInfo <- github auth userInfoCurrentR userInfo `shouldSatisfy` isRight From 8b282c729db67e9c273785d3a6ff093eb2f89347 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 30 Apr 2022 10:37:38 +0200 Subject: [PATCH 068/121] Fix warning introduced by #474 --- src/GitHub/Data/Search.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub/Data/Search.hs b/src/GitHub/Data/Search.hs index 951d1c83..96b9f2c8 100644 --- a/src/GitHub/Data/Search.hs +++ b/src/GitHub/Data/Search.hs @@ -32,7 +32,7 @@ instance Semigroup res => Semigroup (SearchResult' res) where (SearchResult count res) <> (SearchResult count' res') = SearchResult (max count count') (res <> res') instance Foldable SearchResult' where - foldMap f (SearchResult count results) = f results + foldMap f (SearchResult _count results) = f results data Code = Code { codeName :: !Text From e63d4ac814c0e074ca32067a249e79b6f0928546 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 30 Apr 2022 11:10:18 +0200 Subject: [PATCH 069/121] README: link to github-rest (alternative solution) --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 18313f24..8deb6bf1 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,13 @@ Installation In your project's cabal file: ```cabal --- Packages needed in order to build this package. Build-depends: github ``` Or from the command line: ```sh -cabal install github +cabal v1-install github ``` Example Usage @@ -94,3 +93,11 @@ Copyright 2016-2019 Oleg Grenrus. Available under the BSD 3-clause license. [hackage]: http://hackage.haskell.org/package/github "Hackage" + +Alternative +=========== + +Library [`github-rest`](https://hackage.haskell.org/package/github-rest) +also provides an interface to the GitHub API. +It compares itself to `github` here: +https://github.com/LeapYear/github-rest#comparison-to-other-libraries From d9ac0c7ffbcc720a24d06f0a96ea4e3891316d1a Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 30 Apr 2022 10:30:06 +0200 Subject: [PATCH 070/121] Bump to 0.28; CHANGELOG for v0.28 --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ README.md | 2 +- github.cabal | 4 ++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f45068e..f5bdfaaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ +## Changes for 0.28 + +_2022-04-30, Andreas Abel, Valborg edition_ + +Tested with GHC 7.8 - 9.2.2 + +- Add constructors to `IssueRepoMod` that allow filtering issues by + milestone, assignee, creator, mentioned user: + `GitHub.Data.Options.options{Milestone,Assignee,Creator,Mentioned}` + (PR [#470](https://github.com/haskell-github/github/pull/470)) + +- Add permissions field to `Repo`. + This adds record `RepoPermissions` and field `Repo.repoPermissions` + in module `GitHub.Data.Repos`. + (PR [#476](https://github.com/haskell-github/github/pull/476)) + +- Add unwatch request `GitHub.Endpoints.Activity.Watching.unwatchRepoR` + (PR [#473](https://github.com/haskell-github/github/pull/473)) + +Breaking change: + +- Make searches paginated + (PR [#474](https://github.com/haskell-github/github/pull/474)): + * Adds record `GitHub.Data.Repos.CodeSearchRepo`. + * Adds argument `FetchCount` + to `GitHub.Endpoints.Search.search{Repos,Code,Issues,Users}R`. + ## Changes for 0.27 _2021-10-10, Oleg Grenrus_ diff --git a/README.md b/README.md index 8deb6bf1..6203a7b5 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Documentation For details see the reference [documentation on Hackage][hackage]. Each module lines up with the hierarchy of -[documentation from the GitHub API](http://developer.github.com/v3/). +[documentation from the GitHub API](https://docs.github.com/en/rest). Request functions (ending with `R`) construct a data type which can be executed in `IO` by `executeRequest` functions. They are all listed in the root `GitHub` diff --git a/github.cabal b/github.cabal index 868629d4..b00fa5ef 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: github -version: 0.27.1 +version: 0.28 synopsis: Access to the GitHub API, v3. category: Network description: @@ -23,7 +23,7 @@ description: license: BSD3 license-file: LICENSE author: Mike Burns, John Wiegley, Oleg Grenrus -maintainer: Oleg Grenrus +maintainer: Andreas Abel homepage: https://github.com/haskell-github/github build-type: Simple copyright: From 9aa9839a2a1e5e80e9b6d6f61c8288675a1ecede Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sun, 22 May 2022 16:36:45 +0200 Subject: [PATCH 071/121] Relax upper bounds: hspec(-discover), mtl, transformers --- github.cabal | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/github.cabal b/github.cabal index b00fa5ef..2bfb954e 100644 --- a/github.cabal +++ b/github.cabal @@ -170,10 +170,10 @@ library , bytestring >=0.10.4.0 && <0.12 , containers >=0.5.5.1 && <0.7 , deepseq >=1.3.0.2 && <1.5 - , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.3 + , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.4 , text >=1.2.0.6 && <2.1 , time-compat >=1.9.2.2 && <1.10 - , transformers >=0.3.0.0 && <0.6 + , transformers >=0.3.0.0 && <0.7 -- other packages build-depends: @@ -216,7 +216,7 @@ test-suite github-test hs-source-dirs: spec main-is: Spec.hs ghc-options: -Wall -threaded - build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.10 + build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.11 other-extensions: TemplateHaskell other-modules: GitHub.ActivitySpec @@ -241,7 +241,7 @@ test-suite github-test , bytestring , file-embed , github - , hspec >=2.6.1 && <2.10 + , hspec >=2.6.1 && <2.11 , tagged , text , unordered-containers From 7107546062e39348f187d54ce060e0fcb9c1437d Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sun, 22 May 2022 16:55:32 +0200 Subject: [PATCH 072/121] Update Haskell-CI Tried to add constraint-set for mtl-2.3 / transformers-0.6 but time isn't ripe for this yet (some deps do not allow mtl-2.3). --- .github/workflows/haskell-ci.yml | 13 ++++--------- cabal.haskell-ci | 9 +++++++++ cabal.project | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index bbd13145..58b17373 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.14.3.20220416 +# version: 0.15.20220504 # -# REGENDATA ("0.14.3.20220416",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.15.20220504",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -23,7 +23,7 @@ on: jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 timeout-minutes: 60 container: @@ -217,13 +217,8 @@ jobs: if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <=1.3 - constraints: semigroups ^>=0.19 constraints: github +openssl constraints: github-samples +openssl - allow-newer: deepseq-generics-0.2.0.0:base - allow-newer: deepseq-generics-0.2.0.0:ghc-prim - allow-newer: HsOpenSSL:bytestring optimization: False EOF $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local @@ -260,7 +255,7 @@ jobs: if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi - name: haddock run: | - if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi + if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi - name: unconstrained build run: | rm -f cabal.project.local diff --git a/cabal.haskell-ci b/cabal.haskell-ci index eb8a2be2..a937b18a 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -2,3 +2,12 @@ branches: master haddock: >=8.6 -- See PR #355: haddocks for GADT constructor arguments only supported from GHC 8.6 jobs-selection: any + +-- Some dependencies do not allow mtl-2.3 yet, so this doesn't pass yet: +-- constraint-set mtl-2.3 +-- ghc: >= 8.6 +-- constraints: mtl >= 2.3, transformers >= 0.6 + +-- constraint-set text-2.0 +-- constraints: text >= 2.0 +-- allow-newer: *:text -- allow-newer not supported \ No newline at end of file diff --git a/cabal.project b/cabal.project index 3e6d3d45..4b4ee992 100644 --- a/cabal.project +++ b/cabal.project @@ -7,5 +7,5 @@ tests: True constraints: github +openssl constraints: github-samples +openssl -constraints: text >=2 -allow-newer: *:text +-- constraints: text >=2 +-- allow-newer: *:text From 2425a1576d2a1f9f954f18a1e2d9d20c95ef0a4c Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 28 May 2022 18:43:32 +0200 Subject: [PATCH 073/121] Drop unused dependency vector-instances --- github.cabal | 4 ++-- src/GitHub/Internal/Prelude.hs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/github.cabal b/github.cabal index 2bfb954e..0d8d45e9 100644 --- a/github.cabal +++ b/github.cabal @@ -40,6 +40,7 @@ tested-with: || ==8.10.7 || ==9.0.2 || ==9.2.2 + || ==9.4.1 extra-source-files: README.md @@ -165,7 +166,7 @@ library -- Packages bundles with GHC, mtl and text are also here build-depends: - base >=4.7 && <4.17 + base >=4.7 && <5 , binary >=0.7.1.0 && <0.11 , bytestring >=0.10.4.0 && <0.12 , containers >=0.5.5.1 && <0.7 @@ -194,7 +195,6 @@ library , transformers-compat >=0.6.5 && <0.8 , unordered-containers >=0.2.10.0 && <0.3 , vector >=0.12.0.1 && <0.13 - , vector-instances >=3.4 && <3.5 if flag(openssl) build-depends: diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index 2ac8633c..1994abac 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -57,6 +57,5 @@ import Data.Text (Text, pack, unpack) import Data.Time.Compat (UTCTime) import Data.Time.ISO8601 (formatISO8601) import Data.Vector (Vector) -import Data.Vector.Instances () import GHC.Generics (Generic) import Prelude.Compat From d9fce57138ff5db8e2500b21caa76b363e524696 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 28 May 2022 19:46:56 +0200 Subject: [PATCH 074/121] Haskell-CI: include 9.4 alpha --- .github/workflows/haskell-ci.yml | 42 +++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 58b17373..9c414512 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20220504 +# version: 0.15.20220525 # -# REGENDATA ("0.15.20220504",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.15.20220525",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -32,6 +32,11 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.4.0.20220501 + compilerKind: ghc + compilerVersion: 9.4.0.20220501 + setup-method: ghcup + allow-failure: true - compiler: ghc-9.2.2 compilerKind: ghc compilerVersion: 9.2.2 @@ -90,8 +95,9 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 if [ "${{ matrix.setup-method }}" = ghcup ]; then mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" + if $HEADHACKAGE; then "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; fi "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 else @@ -99,7 +105,7 @@ jobs: apt-get update apt-get install -y "$HCNAME" mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 fi @@ -132,7 +138,7 @@ jobs: echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -161,6 +167,17 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + if $HEADHACKAGE; then + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project - if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 71000 && HCNUMVER < 90400)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project ; fi cat cabal.project - name: sdist run: | @@ -211,16 +228,19 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_github}" >> cabal.project - if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi + if [ $((HCNUMVER >= 71000 && HCNUMVER < 90400)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200 && HCNUMVER < 90400)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200 && HCNUMVER < 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project + fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local @@ -251,8 +271,8 @@ jobs: run: | cd ${PKGDIR_github} || false ${CABAL} -vnormal check - if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then cd ${PKGDIR_github_samples} || false ; fi - if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi + if [ $((HCNUMVER >= 71000 && HCNUMVER < 90400)) -ne 0 ] ; then cd ${PKGDIR_github_samples} || false ; fi + if [ $((HCNUMVER >= 71000 && HCNUMVER < 90400)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi - name: haddock run: | if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi From 299ad10ea23d9df5819f5e64dec9dd664ba74bb7 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 28 May 2022 19:56:22 +0200 Subject: [PATCH 075/121] LANGUAGE TypeOperators for GHC 9.4 --- github.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/github.cabal b/github.cabal index 0d8d45e9..e02094c6 100644 --- a/github.cabal +++ b/github.cabal @@ -72,6 +72,7 @@ library DeriveGeneric OverloadedStrings ScopedTypeVariables + TypeOperators other-extensions: CPP From 01c115466d0fe0b879dd16d85d3a730a4142eaae Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Thu, 16 Jun 2022 11:47:58 +0200 Subject: [PATCH 076/121] Allow aeson-2.1 --- github.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github.cabal b/github.cabal index e02094c6..f10beef5 100644 --- a/github.cabal +++ b/github.cabal @@ -179,7 +179,7 @@ library -- other packages build-depends: - aeson >=1.4.0.0 && <1.6 || >=2.0.1.0 && <2.1 + aeson >=1.4.0.0 && <1.6 || >=2.0.1.0 && <2.2 , base-compat >=0.11.1 && <0.13 , base16-bytestring >=0.1.1.6 && <1.1 , binary-instances >=1 && <1.1 From ae33fd36a982b3d5ef55fed4d643910ecd96a984 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 23 Jul 2022 10:50:07 +0200 Subject: [PATCH 077/121] Haskell-CI: bump to 9.2.3 --- .github/workflows/haskell-ci.yml | 35 +++++++++++++++++--------------- cabal.haskell-ci | 2 +- github.cabal | 22 ++++++++++---------- samples/github-samples.cabal | 22 +++++++++++--------- 4 files changed, 43 insertions(+), 38 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 9c414512..ff536274 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,18 +8,20 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20220525 +# version: 0.15.20220710 # -# REGENDATA ("0.15.20220525",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.15.20220710",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: push: branches: - master + - ci* pull_request: branches: - master + - ci* jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} @@ -32,14 +34,14 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.4.0.20220501 + - compiler: ghc-9.4.0.20220623 compilerKind: ghc - compilerVersion: 9.4.0.20220501 + compilerVersion: 9.4.0.20220623 setup-method: ghcup allow-failure: true - - compiler: ghc-9.2.2 + - compiler: ghc-9.2.3 compilerKind: ghc - compilerVersion: 9.2.2 + compilerVersion: 9.2.3 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 @@ -97,9 +99,9 @@ jobs: mkdir -p "$HOME/.ghcup/bin" curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - if $HEADHACKAGE; then "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; fi - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) else apt-add-repository -y 'ppa:hvr/ghc' apt-get update @@ -107,7 +109,7 @@ jobs: mkdir -p "$HOME/.ghcup/bin" curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 + "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: HCKIND: ${{ matrix.compilerKind }} @@ -176,6 +178,7 @@ jobs: 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 key-threshold: 3 + active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override EOF fi cat >> $CABAL_CONFIG <> cabal.project - if [ $((HCNUMVER >= 71000 && HCNUMVER < 90400)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project ; fi cat cabal.project - name: sdist run: | @@ -228,11 +231,11 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_github}" >> cabal.project - if [ $((HCNUMVER >= 71000 && HCNUMVER < 90400)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi + if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200 && HCNUMVER < 90400)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200 && HCNUMVER < 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <= 71000 && HCNUMVER < 90400)) -ne 0 ] ; then cd ${PKGDIR_github_samples} || false ; fi - if [ $((HCNUMVER >= 71000 && HCNUMVER < 90400)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi + if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then cd ${PKGDIR_github_samples} || false ; fi + if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi - name: haddock run: | if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi diff --git a/cabal.haskell-ci b/cabal.haskell-ci index a937b18a..a3ce9738 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -1,4 +1,4 @@ -branches: master +branches: master ci* haddock: >=8.6 -- See PR #355: haddocks for GADT constructor arguments only supported from GHC 8.6 jobs-selection: any diff --git a/github.cabal b/github.cabal index f10beef5..a1fa6a11 100644 --- a/github.cabal +++ b/github.cabal @@ -30,17 +30,17 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC ==7.8.4 - || ==7.10.3 - || ==8.0.2 - || ==8.2.2 - || ==8.4.4 - || ==8.6.5 - || ==8.8.4 - || ==8.10.7 - || ==9.0.2 - || ==9.2.2 - || ==9.4.1 + GHC == 9.4.1 + GHC == 9.2.3 + GHC == 9.0.2 + GHC == 8.10.7 + GHC == 8.8.4 + GHC == 8.6.5 + GHC == 8.4.4 + GHC == 8.2.2 + GHC == 8.0.2 + GHC == 7.10.3 + GHC == 7.8.4 extra-source-files: README.md diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 43b5ac3c..9efe9889 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -5,19 +5,21 @@ category: Examples synopsis: Samples for github package license: BSD-3-Clause license-file: LICENSE -maintainer: Oleg Grenrus +maintainer: Andreas Abel description: Various samples of github package build-type: Simple + tested-with: - GHC ==7.10.3 - || ==8.0.2 - || ==8.2.2 - || ==8.4.4 - || ==8.6.5 - || ==8.8.4 - || ==8.10.7 - || ==9.0.2 - || ==9.2.2 + GHC == 9.4.1 + GHC == 9.2.3 + GHC == 9.0.2 + GHC == 8.10.7 + GHC == 8.8.4 + GHC == 8.6.5 + GHC == 8.4.4 + GHC == 8.2.2 + GHC == 8.0.2 + GHC == 7.10.3 library hs-source-dirs: src From bdae4911d698a107f19ceb54751733baa66f84f3 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 23 Jul 2022 10:50:53 +0200 Subject: [PATCH 078/121] Fix #485: allow vector-0.13 --- github.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github.cabal b/github.cabal index a1fa6a11..3fe795d7 100644 --- a/github.cabal +++ b/github.cabal @@ -195,7 +195,7 @@ library , tagged >=0.8.5 && <0.9 , transformers-compat >=0.6.5 && <0.8 , unordered-containers >=0.2.10.0 && <0.3 - , vector >=0.12.0.1 && <0.13 + , vector >=0.12.0.1 && <0.14 if flag(openssl) build-depends: From 5c897573216503d5cc8ac7b73a60e4c18dbf9c4b Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 23 Jul 2022 10:51:23 +0200 Subject: [PATCH 079/121] Bump to 0.28.0.1 and CHANGELOG --- CHANGELOG.md | 9 +++++++++ github.cabal | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5bdfaaf..f402d4d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## Changes for 0.28.0.1 + +_2022-07-23, Andreas Abel_ + +Tested with GHC 7.8 - 9.4.1 alpha3 + +- Drop unused dependency `vector-instances`. +- Allow latest: `aeson-2.1`, `mtl-2.3`, `vector-0.13`, `transformers-0.6`. + ## Changes for 0.28 _2022-04-30, Andreas Abel, Valborg edition_ diff --git a/github.cabal b/github.cabal index 3fe795d7..56a062f7 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: github -version: 0.28 +version: 0.28.0.1 synopsis: Access to the GitHub API, v3. category: Network description: From 28c74236049f7ae820e47d9c095648cd83ba0e0c Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Mon, 24 Oct 2022 19:49:06 +0200 Subject: [PATCH 080/121] Bump CI to 9.4.2 --- .github/workflows/haskell-ci.yml | 36 +++++++++----------------------- github.cabal | 4 ++-- samples/github-samples.cabal | 4 ++-- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index ff536274..f141f271 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20220710 +# version: 0.15.20221009 # -# REGENDATA ("0.15.20220710",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.15.20221009",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -34,14 +34,14 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.4.0.20220623 + - compiler: ghc-9.4.2 compilerKind: ghc - compilerVersion: 9.4.0.20220623 + compilerVersion: 9.4.2 setup-method: ghcup - allow-failure: true - - compiler: ghc-9.2.3 + allow-failure: false + - compiler: ghc-9.2.4 compilerKind: ghc - compilerVersion: 9.2.3 + compilerVersion: 9.2.4 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 @@ -97,9 +97,8 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 if [ "${{ matrix.setup-method }}" = ghcup ]; then mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) else @@ -107,7 +106,7 @@ jobs: apt-get update apt-get install -y "$HCNAME" mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi @@ -140,7 +139,7 @@ jobs: echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -169,18 +168,6 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF - if $HEADHACKAGE; then - cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project - fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local diff --git a/github.cabal b/github.cabal index 56a062f7..b500a190 100644 --- a/github.cabal +++ b/github.cabal @@ -30,8 +30,8 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC == 9.4.1 - GHC == 9.2.3 + GHC == 9.4.2 + GHC == 9.2.4 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 9efe9889..d95d5a8e 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,8 +10,8 @@ description: Various samples of github package build-type: Simple tested-with: - GHC == 9.4.1 - GHC == 9.2.3 + GHC == 9.4.2 + GHC == 9.2.4 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 From ed296cb891d9d41b81bc3a292432e2c55cc014dc Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sun, 19 Feb 2023 21:07:19 +0100 Subject: [PATCH 081/121] Bump CI to GHC 9.6.0 (#491) No code changes needed for GHC 9.6. --- .github/workflows/haskell-ci.yml | 59 ++++++++++++++++++++++++-------- cabal.project | 1 + github.cabal | 5 +-- samples/github-samples.cabal | 5 +-- 4 files changed, 51 insertions(+), 19 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index f141f271..ea1a4e23 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20221009 +# version: 0.15.20230217 # -# REGENDATA ("0.15.20221009",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.15.20230217",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -34,14 +34,19 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.4.2 + - compiler: ghc-9.6.0.20230210 compilerKind: ghc - compilerVersion: 9.4.2 + compilerVersion: 9.6.0.20230210 + setup-method: ghcup + allow-failure: true + - compiler: ghc-9.4.4 + compilerKind: ghc + compilerVersion: 9.4.4 setup-method: ghcup allow-failure: false - - compiler: ghc-9.2.4 + - compiler: ghc-9.2.6 compilerKind: ghc - compilerVersion: 9.2.4 + compilerVersion: 9.2.6 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 @@ -99,8 +104,9 @@ jobs: mkdir -p "$HOME/.ghcup/bin" curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) else apt-add-repository -y 'ppa:hvr/ghc' apt-get update @@ -108,7 +114,8 @@ jobs: mkdir -p "$HOME/.ghcup/bin" curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; + "$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: HCKIND: ${{ matrix.compilerKind }} @@ -126,20 +133,20 @@ jobs: echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" else HC=$HCDIR/bin/$HCKIND echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" fi HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -168,6 +175,18 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + if $HEADHACKAGE; then + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project <> cabal.project + fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local @@ -235,8 +258,8 @@ jobs: run: | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - - name: cache - uses: actions/cache@v2 + - name: restore cache + uses: actions/cache/restore@v3 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -262,8 +285,14 @@ jobs: if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi - name: haddock run: | - if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi + if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi - name: unconstrained build run: | rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: save cache + uses: actions/cache/save@v3 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store diff --git a/cabal.project b/cabal.project index 4b4ee992..ed0996f6 100644 --- a/cabal.project +++ b/cabal.project @@ -6,6 +6,7 @@ tests: True constraints: github +openssl constraints: github-samples +openssl +constraints: operational -buildExamples -- constraints: text >=2 -- allow-newer: *:text diff --git a/github.cabal b/github.cabal index b500a190..c7f85389 100644 --- a/github.cabal +++ b/github.cabal @@ -30,8 +30,9 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC == 9.4.2 - GHC == 9.2.4 + GHC == 9.6.0 + GHC == 9.4.4 + GHC == 9.2.6 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index d95d5a8e..72fe6368 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,8 +10,9 @@ description: Various samples of github package build-type: Simple tested-with: - GHC == 9.4.2 - GHC == 9.2.4 + GHC == 9.6.0 + GHC == 9.4.4 + GHC == 9.2.6 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 From a6a312601cad1843e418ce14d34c5099b54a41d0 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sun, 12 Mar 2023 19:05:51 +0100 Subject: [PATCH 082/121] v0.28.0.1 Revision 1: Allow base-compat-0.13 --- github.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github.cabal b/github.cabal index c7f85389..5f1c7eea 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,7 @@ cabal-version: >=1.10 name: github version: 0.28.0.1 +x-revision: 1 synopsis: Access to the GitHub API, v3. category: Network description: @@ -181,7 +182,7 @@ library -- other packages build-depends: aeson >=1.4.0.0 && <1.6 || >=2.0.1.0 && <2.2 - , base-compat >=0.11.1 && <0.13 + , base-compat >=0.11.1 && <0.14 , base16-bytestring >=0.1.1.6 && <1.1 , binary-instances >=1 && <1.1 , cryptohash-sha1 >=0.11.100.1 && <0.12 From 9944c53927b5ee5757de0b91888713f2c8f9e031 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sun, 23 Apr 2023 19:50:33 +0200 Subject: [PATCH 083/121] Update badges --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6203a7b5..3ead9b24 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ GitHub ------ +[![Hackage version](https://img.shields.io/hackage/v/github.svg?label=Hackage&color=informational)](http://hackage.haskell.org/package/github) +[![github on Stackage Nightly](https://stackage.org/package/github/badge/nightly)](https://stackage.org/nightly/package/github) +[![Stackage LTS version](https://www.stackage.org/package/github/badge/lts?label=Stackage)](https://www.stackage.org/package/github) [![Haskell-CI](https://github.com/haskell-github/github/actions/workflows/haskell-ci.yml/badge.svg)](https://github.com/haskell-github/github/actions/workflows/haskell-ci.yml) -[![Hackage](https://img.shields.io/hackage/v/github.svg)][hackage] The GitHub API v3 for Haskell. @@ -92,7 +94,7 @@ Copyright 2016-2019 Oleg Grenrus. Available under the BSD 3-clause license. -[hackage]: http://hackage.haskell.org/package/github "Hackage" +[hackage]: https://hackage.haskell.org/package/github "Hackage" Alternative =========== From f63f92c46b3980d06c87959009af21628d06e8a2 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sun, 23 Apr 2023 19:44:20 +0200 Subject: [PATCH 084/121] Bump hspec to allow 2.11 --- .github/workflows/haskell-ci.yml | 49 +++++++++++--------------------- github.cabal | 12 ++++---- samples/github-samples.cabal | 4 +-- 3 files changed, 24 insertions(+), 41 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index ea1a4e23..d4898756 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20230217 +# version: 0.16 # -# REGENDATA ("0.15.20230217",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.16",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -34,19 +34,19 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.6.0.20230210 + - compiler: ghc-9.6.1 compilerKind: ghc - compilerVersion: 9.6.0.20230210 + compilerVersion: 9.6.1 setup-method: ghcup - allow-failure: true + allow-failure: false - compiler: ghc-9.4.4 compilerKind: ghc compilerVersion: 9.4.4 setup-method: ghcup allow-failure: false - - compiler: ghc-9.2.6 + - compiler: ghc-9.2.7 compilerKind: ghc - compilerVersion: 9.2.6 + compilerVersion: 9.2.7 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 @@ -102,20 +102,18 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 if [ "${{ matrix.setup-method }}" = ghcup ]; then mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) else apt-add-repository -y 'ppa:hvr/ghc' apt-get update apt-get install -y "$HCNAME" mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; - "$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: HCKIND: ${{ matrix.compilerKind }} @@ -133,20 +131,20 @@ jobs: echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" else HC=$HCDIR/bin/$HCKIND echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" fi HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -175,18 +173,6 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF - if $HEADHACKAGE; then - cat >> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz - echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz + echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan rm -f cabal-plan.xz chmod a+x $HOME/.cabal/bin/cabal-plan @@ -248,9 +234,6 @@ jobs: constraints: operational -buildExamples optimization: False EOF - if $HEADHACKAGE; then - echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project - fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local diff --git a/github.cabal b/github.cabal index 5f1c7eea..6ecbaab9 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,7 @@ cabal-version: >=1.10 name: github version: 0.28.0.1 -x-revision: 1 +x-revision: 2 synopsis: Access to the GitHub API, v3. category: Network description: @@ -31,9 +31,9 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC == 9.6.0 + GHC == 9.6.1 GHC == 9.4.4 - GHC == 9.2.6 + GHC == 9.2.7 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 @@ -51,7 +51,7 @@ extra-source-files: source-repository head type: git - location: git://github.com/haskell-github/github.git + location: https://github.com/haskell-github/github.git flag openssl description: "Use http-client-openssl" @@ -219,7 +219,7 @@ test-suite github-test hs-source-dirs: spec main-is: Spec.hs ghc-options: -Wall -threaded - build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.11 + build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.12 other-extensions: TemplateHaskell other-modules: GitHub.ActivitySpec @@ -244,7 +244,7 @@ test-suite github-test , bytestring , file-embed , github - , hspec >=2.6.1 && <2.11 + , hspec >=2.6.1 && <2.12 , tagged , text , unordered-containers diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 72fe6368..c758130e 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,9 +10,9 @@ description: Various samples of github package build-type: Simple tested-with: - GHC == 9.6.0 + GHC == 9.6.1 GHC == 9.4.4 - GHC == 9.2.6 + GHC == 9.2.7 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 From 568ede6ed0460cf3c56009d6465ac729112f4ed1 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 13:18:55 +0200 Subject: [PATCH 085/121] Bump Haskell CI to GHC 9.6.2 9.4.5 9.2.8 --- .github/workflows/haskell-ci.yml | 16 ++++++++-------- github.cabal | 6 +++--- samples/github-samples.cabal | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index d4898756..7a5b1d89 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.16 +# version: 0.16.4 # -# REGENDATA ("0.16",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.16.4",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -34,19 +34,19 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.6.1 + - compiler: ghc-9.6.2 compilerKind: ghc - compilerVersion: 9.6.1 + compilerVersion: 9.6.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.4.4 + - compiler: ghc-9.4.5 compilerKind: ghc - compilerVersion: 9.4.4 + compilerVersion: 9.4.5 setup-method: ghcup allow-failure: false - - compiler: ghc-9.2.7 + - compiler: ghc-9.2.8 compilerKind: ghc - compilerVersion: 9.2.7 + compilerVersion: 9.2.8 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 diff --git a/github.cabal b/github.cabal index 6ecbaab9..34389c64 100644 --- a/github.cabal +++ b/github.cabal @@ -31,9 +31,9 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC == 9.6.1 - GHC == 9.4.4 - GHC == 9.2.7 + GHC == 9.6.2 + GHC == 9.4.5 + GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index c758130e..c76d6b14 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,9 +10,9 @@ description: Various samples of github package build-type: Simple tested-with: - GHC == 9.6.1 - GHC == 9.4.4 - GHC == 9.2.7 + GHC == 9.6.2 + GHC == 9.4.5 + GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 GHC == 8.8.4 From 445c8de7300b25b51a4c6850e9468dcb6bc7f534 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 14:23:10 +0200 Subject: [PATCH 086/121] Resurrect samples/Issues/ShowRepoIssues This example wasn't ported to the new API. Now it is, with some ugly `show`s still. --- .github/workflows/haskell-ci.yml | 12 +++++----- samples/Issues/ShowRepoIssues.hs | 38 ++++++++++++++++++++------------ samples/github-samples.cabal | 11 +++++---- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 7a5b1d89..b5d24eb9 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -203,7 +203,7 @@ jobs: run: | touch cabal.project echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project - if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/samples" >> cabal.project ; fi cat cabal.project - name: sdist run: | @@ -223,11 +223,11 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_github}" >> cabal.project - if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <= 71000)) -ne 0 ] ; then cd ${PKGDIR_github_samples} || false ; fi - if [ $((HCNUMVER >= 71000)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then cd ${PKGDIR_github_samples} || false ; fi + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi - name: haddock run: | if [ $((HCNUMVER >= 80600)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi diff --git a/samples/Issues/ShowRepoIssues.hs b/samples/Issues/ShowRepoIssues.hs index b6f26e68..3bfaa4ba 100644 --- a/samples/Issues/ShowRepoIssues.hs +++ b/samples/Issues/ShowRepoIssues.hs @@ -1,21 +1,31 @@ -module ShowRepoIssue where +{-# LANGUAGE OverloadedStrings #-} -import qualified Github.Issues as Github +import qualified GitHub as Github import Data.List (intercalate) +import Data.Foldable (toList) +main :: IO () main = do - let limitations = [Github.OnlyClosed, Github.Mentions "mike-burns", Github.AssignedTo "jyurek"] - possibleIssues <- Github.issuesForRepo "thoughtbot" "paperclip" limitations + let filt = Github.stateClosed <> Github.optionsMentioned "mike-burns" <> Github.optionsAssignee "jyurek" + possibleIssues <- Github.github' $ Github.issuesForRepoR "thoughtbot" "paperclip" filt Github.FetchAll case possibleIssues of - (Left error) -> putStrLn $ "Error: " ++ show error - (Right issues) -> - putStrLn $ intercalate "\n\n" $ map formatIssue issues + Left err -> putStrLn $ "Error: " ++ show err + Right issues -> + putStrLn $ intercalate "\n\n" $ map formatIssue $ toList issues -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) +formatIssue :: Github.Issue -> String +formatIssue issue = concat + [ show $ Github.simpleUserLogin $ Github.issueUser issue + , " opened this issue " + , show $ Github.issueCreatedAt issue + , ".\n" + + , "It is currently " + , show $ Github.issueState issue + , " with " + , show $ Github.issueComments issue + , " comments.\n\n" + + , show $ Github.issueTitle issue + ] diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index c76d6b14..c3c6813d 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -18,15 +18,13 @@ tested-with: GHC == 8.8.4 GHC == 8.6.5 GHC == 8.4.4 - GHC == 8.2.2 - GHC == 8.0.2 - GHC == 7.10.3 library hs-source-dirs: src ghc-options: -Wall build-depends: - , base >=4.7 && <5 + , base >=4.11 && <5 + -- require base-4.11 because then (<>) is in Prelude , base-compat-batteries , github , text @@ -149,6 +147,11 @@ executable github-list-team-current -- main-is: ShowDeployKey.hs -- hs-source-dirs: Repos/DeployKeys +executable github-show-repo-issues + import: deps + main-is: ShowRepoIssues.hs + hs-source-dirs: Issues + executable github-show-user import: deps main-is: ShowUser.hs From 723884baa49627fe24424c493ba4c6436df53492 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 14:39:03 +0200 Subject: [PATCH 087/121] Parse `state_reason` (values: completed, not_planned, reopened) Added `issueStateReason` to `Issue`. --- CHANGELOG.md | 10 ++++++++++ github.cabal | 4 ++-- samples/Issues/ShowRepoIssues.hs | 25 ++++++++++++++++++------- src/GitHub/Data/Issues.hs | 4 +++- src/GitHub/Data/Options.hs | 25 +++++++++++++++++++++++++ 5 files changed, 58 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f402d4d1..1fa91d95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## Changes for 0.29 + +_2022-06-24, Andreas Abel, Midsommar edition_ + +- Add field `issueStateReason` of type `Maybe IssueStateReason` to `Issue` + with possible values `completed`, `not_planned` and `reopened` + (PR [#496](https://github.com/haskell-github/github/pull/496)). + +Tested with GHC 7.8 - 9.6.2 + ## Changes for 0.28.0.1 _2022-07-23, Andreas Abel_ diff --git a/github.cabal b/github.cabal index 34389c64..a0669042 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,6 @@ cabal-version: >=1.10 name: github -version: 0.28.0.1 -x-revision: 2 +version: 0.29 synopsis: Access to the GitHub API, v3. category: Network description: @@ -72,6 +71,7 @@ library DataKinds DeriveDataTypeable DeriveGeneric + LambdaCase OverloadedStrings ScopedTypeVariables TypeOperators diff --git a/samples/Issues/ShowRepoIssues.hs b/samples/Issues/ShowRepoIssues.hs index 3bfaa4ba..5f54026b 100644 --- a/samples/Issues/ShowRepoIssues.hs +++ b/samples/Issues/ShowRepoIssues.hs @@ -1,17 +1,27 @@ +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} -import qualified GitHub as Github -import Data.List (intercalate) import Data.Foldable (toList) +import Data.List (intercalate) +import Data.Vector (Vector) + +import qualified GitHub as Github main :: IO () main = do let filt = Github.stateClosed <> Github.optionsMentioned "mike-burns" <> Github.optionsAssignee "jyurek" - possibleIssues <- Github.github' $ Github.issuesForRepoR "thoughtbot" "paperclip" filt Github.FetchAll - case possibleIssues of - Left err -> putStrLn $ "Error: " ++ show err - Right issues -> - putStrLn $ intercalate "\n\n" $ map formatIssue $ toList issues + printIssues =<< do + Github.github' $ Github.issuesForRepoR "thoughtbot" "paperclip" filt Github.FetchAll + + printIssues =<< do + Github.github' $ Github.issuesForRepoR "haskell-github" "playground" Github.stateClosed Github.FetchAll + +printIssues :: Either Github.Error (Vector Github.Issue) -> IO () +printIssues = \case + Left err -> + putStrLn $ "Error: " ++ show err + Right issues -> + putStrLn $ intercalate "\n\n" $ map formatIssue $ toList issues formatIssue :: Github.Issue -> String formatIssue issue = concat @@ -23,6 +33,7 @@ formatIssue issue = concat , "It is currently " , show $ Github.issueState issue + , maybe "" (\ r -> " with reason " ++ show r) $ Github.issueStateReason issue , " with " , show $ Github.issueComments issue , " comments.\n\n" diff --git a/src/GitHub/Data/Issues.hs b/src/GitHub/Data/Issues.hs index 6e98da8f..3ec17781 100644 --- a/src/GitHub/Data/Issues.hs +++ b/src/GitHub/Data/Issues.hs @@ -9,7 +9,7 @@ import GitHub.Data.Definitions import GitHub.Data.Id (Id) import GitHub.Data.Milestone (Milestone) import GitHub.Data.Name (Name) -import GitHub.Data.Options (IssueState) +import GitHub.Data.Options (IssueState, IssueStateReason) import GitHub.Data.PullRequests import GitHub.Data.URL (URL) import GitHub.Internal.Prelude @@ -36,6 +36,7 @@ data Issue = Issue , issueId :: !(Id Issue) , issueComments :: !Int , issueMilestone :: !(Maybe Milestone) + , issueStateReason :: !(Maybe IssueStateReason) } deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -203,6 +204,7 @@ instance FromJSON Issue where <*> o .: "id" <*> o .: "comments" <*> o .:? "milestone" + <*> o .:? "state_reason" instance ToJSON NewIssue where toJSON (NewIssue t b a m ls) = object $ filter notNull diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 24bc4369..5d27e0b1 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -50,6 +50,7 @@ module GitHub.Data.Options ( optionsAssignee, -- * Data IssueState (..), + IssueStateReason (..), MergeableState (..), -- * Internal HasState, @@ -94,6 +95,30 @@ instance FromJSON IssueState where instance NFData IssueState where rnf = genericRnf instance Binary IssueState +-- | 'GitHub.Data.Issues.Issue' state reason +data IssueStateReason + = StateReasonCompleted + | StateReasonNotPlanned + | StateReasonReopened + deriving + (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + +instance ToJSON IssueStateReason where + toJSON = String . \case + StateReasonCompleted -> "completed" + StateReasonNotPlanned -> "not_planned" + StateReasonReopened -> "reopened" + +instance FromJSON IssueStateReason where + parseJSON = withText "IssueStateReason" $ \t -> case T.toLower t of + "completed" -> pure StateReasonCompleted + "not_planned" -> pure StateReasonNotPlanned + "reopened" -> pure StateReasonReopened + _ -> fail $ "Unknown IssueStateReason: " <> T.unpack t + +instance NFData IssueStateReason where rnf = genericRnf +instance Binary IssueStateReason + -- | 'GitHub.Data.PullRequests.PullRequest' mergeable_state data MergeableState = StateUnknown From a2739ee3821a41ccf0686ae4f797575ff74adb81 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 16:57:41 +0200 Subject: [PATCH 088/121] Remove outdated maintainer from module headers --- src/GitHub.hs | 6 +----- src/GitHub/Auth.hs | 5 ----- src/GitHub/Data.hs | 6 ++---- src/GitHub/Data/Activities.hs | 6 ------ src/GitHub/Data/Comments.hs | 5 ----- src/GitHub/Data/Content.hs | 6 +----- src/GitHub/Data/Definitions.hs | 5 ----- src/GitHub/Data/Email.hs | 5 ----- src/GitHub/Data/Enterprise.hs | 5 +---- src/GitHub/Data/Enterprise/Organizations.hs | 5 ----- src/GitHub/Data/Events.hs | 6 +----- src/GitHub/Data/Gists.hs | 5 ----- src/GitHub/Data/GitData.hs | 5 ----- src/GitHub/Data/Id.hs | 5 ----- src/GitHub/Data/Invitation.hs | 5 ----- src/GitHub/Data/Issues.hs | 5 ----- src/GitHub/Data/Milestone.hs | 5 ----- src/GitHub/Data/Name.hs | 5 ----- src/GitHub/Data/Options.hs | 6 ++---- src/GitHub/Data/PullRequests.hs | 5 ----- src/GitHub/Data/RateLimit.hs | 5 ----- src/GitHub/Data/Repos.hs | 6 ++---- src/GitHub/Data/Request.hs | 6 +----- src/GitHub/Data/Search.hs | 5 ----- src/GitHub/Data/Teams.hs | 6 +----- src/GitHub/Data/URL.hs | 5 ----- src/GitHub/Data/Webhooks.hs | 5 ----- src/GitHub/Data/Webhooks/Validate.hs | 5 +---- src/GitHub/Endpoints/Activity/Events.hs | 5 +---- src/GitHub/Endpoints/Activity/Notifications.hs | 4 ---- src/GitHub/Endpoints/Activity/Starring.hs | 5 +---- src/GitHub/Endpoints/Activity/Watching.hs | 5 +---- src/GitHub/Endpoints/Enterprise/Organizations.hs | 5 +---- src/GitHub/Endpoints/Gists.hs | 5 +---- src/GitHub/Endpoints/Gists/Comments.hs | 5 +---- src/GitHub/Endpoints/GitData/Blobs.hs | 5 +---- src/GitHub/Endpoints/GitData/Commits.hs | 5 +---- src/GitHub/Endpoints/GitData/References.hs | 5 +---- src/GitHub/Endpoints/GitData/Trees.hs | 5 +---- src/GitHub/Endpoints/Issues.hs | 6 ++---- src/GitHub/Endpoints/Issues/Comments.hs | 5 +---- src/GitHub/Endpoints/Issues/Events.hs | 5 +---- src/GitHub/Endpoints/Issues/Labels.hs | 5 +---- src/GitHub/Endpoints/Issues/Milestones.hs | 5 +---- src/GitHub/Endpoints/Organizations.hs | 5 +---- src/GitHub/Endpoints/Organizations/Members.hs | 5 +---- src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs | 5 +---- src/GitHub/Endpoints/Organizations/Teams.hs | 5 +---- src/GitHub/Endpoints/PullRequests.hs | 6 +----- src/GitHub/Endpoints/PullRequests/Comments.hs | 5 +---- src/GitHub/Endpoints/PullRequests/Reviews.hs | 5 +---- src/GitHub/Endpoints/RateLimit.hs | 5 +---- src/GitHub/Endpoints/Repos.hs | 5 +---- src/GitHub/Endpoints/Repos/Collaborators.hs | 5 +---- src/GitHub/Endpoints/Repos/Comments.hs | 6 ++---- src/GitHub/Endpoints/Repos/Commits.hs | 6 ++---- src/GitHub/Endpoints/Repos/Contents.hs | 5 +---- src/GitHub/Endpoints/Repos/Forks.hs | 5 +---- src/GitHub/Endpoints/Repos/Invitations.hs | 5 +---- src/GitHub/Endpoints/Repos/Statuses.hs | 5 +---- src/GitHub/Endpoints/Repos/Webhooks.hs | 5 +---- src/GitHub/Endpoints/Search.hs | 5 +---- src/GitHub/Endpoints/Users.hs | 5 +---- src/GitHub/Endpoints/Users/Emails.hs | 5 +---- src/GitHub/Endpoints/Users/Followers.hs | 5 +---- src/GitHub/Enterprise.hs | 6 +----- src/GitHub/Internal/Prelude.hs | 6 ++---- src/GitHub/Request.hs | 6 ++---- 68 files changed, 57 insertions(+), 298 deletions(-) diff --git a/src/GitHub.hs b/src/GitHub.hs index da5e9f2b..10e34602 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -1,8 +1,4 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- This module re-exports all request constructors and data definitions from -- this package. -- @@ -16,7 +12,7 @@ -- -- The missing endpoints lists show which endpoints we know are missing, there -- might be more. --- + module GitHub ( -- * Activity -- | See diff --git a/src/GitHub/Auth.hs b/src/GitHub/Auth.hs index 432b2486..ccc2415a 100644 --- a/src/GitHub/Auth.hs +++ b/src/GitHub/Auth.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Auth ( Auth (..), AuthMethod, diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 6b475d40..4d8748f8 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -1,10 +1,8 @@ {-# LANGUAGE CPP #-} ------------------------------------------------------------------------------ + -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- This module re-exports the @GitHub.Data.@ and "GitHub.Auth" submodules. + module GitHub.Data ( -- * Tagged types -- ** Name diff --git a/src/GitHub/Data/Activities.hs b/src/GitHub/Data/Activities.hs index d95d3a25..e03986dc 100644 --- a/src/GitHub/Data/Activities.hs +++ b/src/GitHub/Data/Activities.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Activities where import GitHub.Data.Id (Id, mkId) @@ -107,4 +102,3 @@ instance FromJSON Notification where <*> o .: "updated_at" <*> o .: "last_read_at" <*> o .: "url" - diff --git a/src/GitHub/Data/Comments.hs b/src/GitHub/Data/Comments.hs index cb52b04b..d4a9194d 100644 --- a/src/GitHub/Data/Comments.hs +++ b/src/GitHub/Data/Comments.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Comments where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/Content.hs b/src/GitHub/Data/Content.hs index 7a4dca9b..d776c2b6 100644 --- a/src/GitHub/Data/Content.hs +++ b/src/GitHub/Data/Content.hs @@ -1,10 +1,6 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE CPP #-} ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- + module GitHub.Data.Content where import GitHub.Data.GitData diff --git a/src/GitHub/Data/Definitions.hs b/src/GitHub/Data/Definitions.hs index 0d56171b..73962f28 100644 --- a/src/GitHub/Data/Definitions.hs +++ b/src/GitHub/Data/Definitions.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Definitions where import GitHub.Internal.Prelude diff --git a/src/GitHub/Data/Email.hs b/src/GitHub/Data/Email.hs index d27237e5..9ff578b6 100644 --- a/src/GitHub/Data/Email.hs +++ b/src/GitHub/Data/Email.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Email where import GitHub.Internal.Prelude diff --git a/src/GitHub/Data/Enterprise.hs b/src/GitHub/Data/Enterprise.hs index 125a8d69..dd5b9337 100644 --- a/src/GitHub/Data/Enterprise.hs +++ b/src/GitHub/Data/Enterprise.hs @@ -1,9 +1,6 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- This module re-exports the @GitHub.Data.Enterprise.@ submodules. + module GitHub.Data.Enterprise ( -- * Module re-exports module GitHub.Data.Enterprise.Organizations, diff --git a/src/GitHub/Data/Enterprise/Organizations.hs b/src/GitHub/Data/Enterprise/Organizations.hs index 967cd718..9c48f386 100644 --- a/src/GitHub/Data/Enterprise/Organizations.hs +++ b/src/GitHub/Data/Enterprise/Organizations.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Enterprise.Organizations where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/Events.hs b/src/GitHub/Data/Events.hs index d7b34528..db0e881a 100644 --- a/src/GitHub/Data/Events.hs +++ b/src/GitHub/Data/Events.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Events where import GitHub.Data.Definitions @@ -14,6 +9,7 @@ import Prelude () -- /TODO:/ -- -- * missing repo, org, payload, id +-- data Event = Event -- { eventId :: !(Id Event) -- id can be encoded as string. { eventActor :: !SimpleUser diff --git a/src/GitHub/Data/Gists.hs b/src/GitHub/Data/Gists.hs index b6d1b673..ab2e846d 100644 --- a/src/GitHub/Data/Gists.hs +++ b/src/GitHub/Data/Gists.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Gists where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/GitData.hs b/src/GitHub/Data/GitData.hs index fa9973d1..95b47533 100644 --- a/src/GitHub/Data/GitData.hs +++ b/src/GitHub/Data/GitData.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.GitData where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/Id.hs b/src/GitHub/Data/Id.hs index e0dcfe27..ddbc9e25 100644 --- a/src/GitHub/Data/Id.hs +++ b/src/GitHub/Data/Id.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Id ( Id(..), mkId, diff --git a/src/GitHub/Data/Invitation.hs b/src/GitHub/Data/Invitation.hs index 894ce64f..1ea656f9 100644 --- a/src/GitHub/Data/Invitation.hs +++ b/src/GitHub/Data/Invitation.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Invitation where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/Issues.hs b/src/GitHub/Data/Issues.hs index 3ec17781..191b342e 100644 --- a/src/GitHub/Data/Issues.hs +++ b/src/GitHub/Data/Issues.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Issues where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/Milestone.hs b/src/GitHub/Data/Milestone.hs index a8db2864..385678d1 100644 --- a/src/GitHub/Data/Milestone.hs +++ b/src/GitHub/Data/Milestone.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Milestone where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/Name.hs b/src/GitHub/Data/Name.hs index 35c12b0c..dbc09653 100644 --- a/src/GitHub/Data/Name.hs +++ b/src/GitHub/Data/Name.hs @@ -1,9 +1,4 @@ {-# LANGUAGE CPP #-} ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Name ( Name(..), mkName, diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 5d27e0b1..87c489a7 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -1,10 +1,8 @@ {-# LANGUAGE RecordWildCards #-} ------------------------------------------------------------------------------ + -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- Module with modifiers for pull requests' and issues' listings. + module GitHub.Data.Options ( -- * Common modifiers stateOpen, diff --git a/src/GitHub/Data/PullRequests.hs b/src/GitHub/Data/PullRequests.hs index 0075986a..79054b6a 100644 --- a/src/GitHub/Data/PullRequests.hs +++ b/src/GitHub/Data/PullRequests.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.PullRequests ( SimplePullRequest(..), PullRequest(..), diff --git a/src/GitHub/Data/RateLimit.hs b/src/GitHub/Data/RateLimit.hs index 2ba008f0..2db078af 100644 --- a/src/GitHub/Data/RateLimit.hs +++ b/src/GitHub/Data/RateLimit.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.RateLimit where import GitHub.Internal.Prelude diff --git a/src/GitHub/Data/Repos.hs b/src/GitHub/Data/Repos.hs index 63779d77..98c254c2 100644 --- a/src/GitHub/Data/Repos.hs +++ b/src/GitHub/Data/Repos.hs @@ -1,14 +1,12 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} #define UNSAFE 1 ------------------------------------------------------------------------------ + -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- This module also exports -- @'FromJSON' a => 'FromJSON' ('HM.HashMap' 'Language' a)@ -- orphan-ish instance for @aeson < 1@ + module GitHub.Data.Repos where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index 4180a938..445c4223 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -3,11 +3,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE StandaloneDeriving #-} ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- + module GitHub.Data.Request ( -- * Request Request, diff --git a/src/GitHub/Data/Search.hs b/src/GitHub/Data/Search.hs index 96b9f2c8..b56067b0 100644 --- a/src/GitHub/Data/Search.hs +++ b/src/GitHub/Data/Search.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Search where import GitHub.Data.Repos (CodeSearchRepo) diff --git a/src/GitHub/Data/Teams.hs b/src/GitHub/Data/Teams.hs index 79ef9706..622370ae 100644 --- a/src/GitHub/Data/Teams.hs +++ b/src/GitHub/Data/Teams.hs @@ -2,11 +2,7 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- + module GitHub.Data.Teams where import GitHub.Data.Definitions diff --git a/src/GitHub/Data/URL.hs b/src/GitHub/Data/URL.hs index 9b29b673..d98703ae 100644 --- a/src/GitHub/Data/URL.hs +++ b/src/GitHub/Data/URL.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.URL ( URL(..), getUrl, diff --git a/src/GitHub/Data/Webhooks.hs b/src/GitHub/Data/Webhooks.hs index 8ca2fe8e..143d8006 100644 --- a/src/GitHub/Data/Webhooks.hs +++ b/src/GitHub/Data/Webhooks.hs @@ -1,8 +1,3 @@ ------------------------------------------------------------------------------ --- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- module GitHub.Data.Webhooks where import GitHub.Data.Id (Id) diff --git a/src/GitHub/Data/Webhooks/Validate.hs b/src/GitHub/Data/Webhooks/Validate.hs index a90d4e23..1ea7590b 100644 --- a/src/GitHub/Data/Webhooks/Validate.hs +++ b/src/GitHub/Data/Webhooks/Validate.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- Verification of incomming webhook payloads, as described at -- + module GitHub.Data.Webhooks.Validate ( isValidPayload ) where diff --git a/src/GitHub/Endpoints/Activity/Events.hs b/src/GitHub/Endpoints/Activity/Events.hs index 8074ab2a..1b0676e9 100644 --- a/src/GitHub/Endpoints/Activity/Events.hs +++ b/src/GitHub/Endpoints/Activity/Events.hs @@ -1,9 +1,6 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The events API as described on . + module GitHub.Endpoints.Activity.Events ( -- * Events repositoryEventsR, diff --git a/src/GitHub/Endpoints/Activity/Notifications.hs b/src/GitHub/Endpoints/Activity/Notifications.hs index 7c246c54..7a900aa7 100644 --- a/src/GitHub/Endpoints/Activity/Notifications.hs +++ b/src/GitHub/Endpoints/Activity/Notifications.hs @@ -1,8 +1,4 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The repo watching API as described on -- . diff --git a/src/GitHub/Endpoints/Activity/Starring.hs b/src/GitHub/Endpoints/Activity/Starring.hs index be589db0..7d77057b 100644 --- a/src/GitHub/Endpoints/Activity/Starring.hs +++ b/src/GitHub/Endpoints/Activity/Starring.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The repo starring API as described on -- . + module GitHub.Endpoints.Activity.Starring ( stargazersForR, reposStarredByR, diff --git a/src/GitHub/Endpoints/Activity/Watching.hs b/src/GitHub/Endpoints/Activity/Watching.hs index 92b7829d..3ad5954b 100644 --- a/src/GitHub/Endpoints/Activity/Watching.hs +++ b/src/GitHub/Endpoints/Activity/Watching.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The repo watching API as described on -- . + module GitHub.Endpoints.Activity.Watching ( watchersForR, reposWatchedByR, diff --git a/src/GitHub/Endpoints/Enterprise/Organizations.hs b/src/GitHub/Endpoints/Enterprise/Organizations.hs index 589c3d35..1e71334f 100644 --- a/src/GitHub/Endpoints/Enterprise/Organizations.hs +++ b/src/GitHub/Endpoints/Enterprise/Organizations.hs @@ -1,9 +1,6 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The GitHub Enterprise orgs API as described on . + module GitHub.Endpoints.Enterprise.Organizations ( createOrganizationR, renameOrganizationR, diff --git a/src/GitHub/Endpoints/Gists.hs b/src/GitHub/Endpoints/Gists.hs index de8e6c20..da1fc194 100644 --- a/src/GitHub/Endpoints/Gists.hs +++ b/src/GitHub/Endpoints/Gists.hs @@ -1,9 +1,6 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The gists API as described at . + module GitHub.Endpoints.Gists ( gistsR, gistR, diff --git a/src/GitHub/Endpoints/Gists/Comments.hs b/src/GitHub/Endpoints/Gists/Comments.hs index d6a127dd..5234a63c 100644 --- a/src/GitHub/Endpoints/Gists/Comments.hs +++ b/src/GitHub/Endpoints/Gists/Comments.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The loving comments people have left on Gists, described on -- . + module GitHub.Endpoints.Gists.Comments ( commentsOnR, gistCommentR, diff --git a/src/GitHub/Endpoints/GitData/Blobs.hs b/src/GitHub/Endpoints/GitData/Blobs.hs index 4c3c5f88..c7b39aea 100644 --- a/src/GitHub/Endpoints/GitData/Blobs.hs +++ b/src/GitHub/Endpoints/GitData/Blobs.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The API for dealing with git blobs from Github repos, as described in -- . + module GitHub.Endpoints.GitData.Blobs ( blobR, module GitHub.Data, diff --git a/src/GitHub/Endpoints/GitData/Commits.hs b/src/GitHub/Endpoints/GitData/Commits.hs index 109ca87d..82a18bf3 100644 --- a/src/GitHub/Endpoints/GitData/Commits.hs +++ b/src/GitHub/Endpoints/GitData/Commits.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The API for underlying git commits of a Github repo, as described on -- . + module GitHub.Endpoints.GitData.Commits ( gitCommitR, module GitHub.Data, diff --git a/src/GitHub/Endpoints/GitData/References.hs b/src/GitHub/Endpoints/GitData/References.hs index bf64657f..a1f10814 100644 --- a/src/GitHub/Endpoints/GitData/References.hs +++ b/src/GitHub/Endpoints/GitData/References.hs @@ -1,11 +1,8 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The underlying git references on a Github repo, exposed for the world to -- see. The git internals documentation will also prove handy for understanding -- these. API documentation at . + module GitHub.Endpoints.GitData.References ( referenceR, referencesR, diff --git a/src/GitHub/Endpoints/GitData/Trees.hs b/src/GitHub/Endpoints/GitData/Trees.hs index 434d8e95..4bdf389b 100644 --- a/src/GitHub/Endpoints/GitData/Trees.hs +++ b/src/GitHub/Endpoints/GitData/Trees.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The underlying tree of SHA1s and files that make up a git repo. The API is -- described on . + module GitHub.Endpoints.GitData.Trees ( treeR, nestedTreeR, diff --git a/src/GitHub/Endpoints/Issues.hs b/src/GitHub/Endpoints/Issues.hs index f1980dbf..9cd7258f 100644 --- a/src/GitHub/Endpoints/Issues.hs +++ b/src/GitHub/Endpoints/Issues.hs @@ -1,10 +1,8 @@ {-# LANGUAGE CPP #-} ------------------------------------------------------------------------------ + -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The issues API as described on . + module GitHub.Endpoints.Issues ( currentUserIssuesR, organizationIssuesR, diff --git a/src/GitHub/Endpoints/Issues/Comments.hs b/src/GitHub/Endpoints/Issues/Comments.hs index 18550abc..0c307d3f 100644 --- a/src/GitHub/Endpoints/Issues/Comments.hs +++ b/src/GitHub/Endpoints/Issues/Comments.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The Github issue comments API from -- . + module GitHub.Endpoints.Issues.Comments ( commentR, commentsR, diff --git a/src/GitHub/Endpoints/Issues/Events.hs b/src/GitHub/Endpoints/Issues/Events.hs index e69ed9fa..0639026c 100644 --- a/src/GitHub/Endpoints/Issues/Events.hs +++ b/src/GitHub/Endpoints/Issues/Events.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The Github issue events API, which is described on -- + module GitHub.Endpoints.Issues.Events ( eventsForIssueR, eventsForRepoR, diff --git a/src/GitHub/Endpoints/Issues/Labels.hs b/src/GitHub/Endpoints/Issues/Labels.hs index 3d129e8c..bdf2319d 100644 --- a/src/GitHub/Endpoints/Issues/Labels.hs +++ b/src/GitHub/Endpoints/Issues/Labels.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The API for dealing with labels on Github issues as described on -- . + module GitHub.Endpoints.Issues.Labels ( labelsOnRepoR, labelR, diff --git a/src/GitHub/Endpoints/Issues/Milestones.hs b/src/GitHub/Endpoints/Issues/Milestones.hs index 78b6531d..18d5d9d4 100644 --- a/src/GitHub/Endpoints/Issues/Milestones.hs +++ b/src/GitHub/Endpoints/Issues/Milestones.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The milestones API as described on -- . + module GitHub.Endpoints.Issues.Milestones ( milestonesR, milestoneR, diff --git a/src/GitHub/Endpoints/Organizations.hs b/src/GitHub/Endpoints/Organizations.hs index 12844510..0cb3da47 100644 --- a/src/GitHub/Endpoints/Organizations.hs +++ b/src/GitHub/Endpoints/Organizations.hs @@ -1,9 +1,6 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The orgs API as described on . + module GitHub.Endpoints.Organizations ( publicOrganizationsForR, publicOrganizationR, diff --git a/src/GitHub/Endpoints/Organizations/Members.hs b/src/GitHub/Endpoints/Organizations/Members.hs index 26a8f4c4..84e52e43 100644 --- a/src/GitHub/Endpoints/Organizations/Members.hs +++ b/src/GitHub/Endpoints/Organizations/Members.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The organization members API as described on -- . + module GitHub.Endpoints.Organizations.Members ( membersOfR, membersOfWithR, diff --git a/src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs b/src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs index 9bc392dd..dee42fcf 100644 --- a/src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs +++ b/src/GitHub/Endpoints/Organizations/OutsideCollaborators.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The organization members API as described on -- . + module GitHub.Endpoints.Organizations.OutsideCollaborators ( outsideCollaboratorsR, ) where diff --git a/src/GitHub/Endpoints/Organizations/Teams.hs b/src/GitHub/Endpoints/Organizations/Teams.hs index 189e68f7..af8c8b36 100644 --- a/src/GitHub/Endpoints/Organizations/Teams.hs +++ b/src/GitHub/Endpoints/Organizations/Teams.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The Owner teams API as described on -- . + module GitHub.Endpoints.Organizations.Teams ( teamsOfR, teamInfoForR, diff --git a/src/GitHub/Endpoints/PullRequests.hs b/src/GitHub/Endpoints/PullRequests.hs index 7217e51b..5e5d6aac 100644 --- a/src/GitHub/Endpoints/PullRequests.hs +++ b/src/GitHub/Endpoints/PullRequests.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The pull requests API as documented at -- . + module GitHub.Endpoints.PullRequests ( pullRequestsForR, pullRequestR, @@ -102,4 +99,3 @@ mergePullRequestR user repo prid commitMessage = buildCommitMessageMap :: Maybe Text -> Value buildCommitMessageMap (Just msg) = object ["commit_message" .= msg ] buildCommitMessageMap Nothing = object [] - diff --git a/src/GitHub/Endpoints/PullRequests/Comments.hs b/src/GitHub/Endpoints/PullRequests/Comments.hs index 9bb6fca2..e1117921 100644 --- a/src/GitHub/Endpoints/PullRequests/Comments.hs +++ b/src/GitHub/Endpoints/PullRequests/Comments.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The pull request review comments API as described at -- . + module GitHub.Endpoints.PullRequests.Comments ( pullRequestCommentsR, pullRequestCommentR, diff --git a/src/GitHub/Endpoints/PullRequests/Reviews.hs b/src/GitHub/Endpoints/PullRequests/Reviews.hs index fe95d25b..e746e570 100644 --- a/src/GitHub/Endpoints/PullRequests/Reviews.hs +++ b/src/GitHub/Endpoints/PullRequests/Reviews.hs @@ -1,9 +1,6 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The reviews API as described on . + module GitHub.Endpoints.PullRequests.Reviews ( pullRequestReviewsR , pullRequestReviewR diff --git a/src/GitHub/Endpoints/RateLimit.hs b/src/GitHub/Endpoints/RateLimit.hs index 3bbe8c2f..8d559613 100644 --- a/src/GitHub/Endpoints/RateLimit.hs +++ b/src/GitHub/Endpoints/RateLimit.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The Github RateLimit API, as described at -- . + module GitHub.Endpoints.RateLimit ( rateLimitR, module GitHub.Data, diff --git a/src/GitHub/Endpoints/Repos.hs b/src/GitHub/Endpoints/Repos.hs index b8c9d79d..85c8b639 100644 --- a/src/GitHub/Endpoints/Repos.hs +++ b/src/GitHub/Endpoints/Repos.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The Github Repos API, as documented at -- + module GitHub.Endpoints.Repos ( -- * Querying repositories currentUserReposR, diff --git a/src/GitHub/Endpoints/Repos/Collaborators.hs b/src/GitHub/Endpoints/Repos/Collaborators.hs index 5322b36d..f587636d 100644 --- a/src/GitHub/Endpoints/Repos/Collaborators.hs +++ b/src/GitHub/Endpoints/Repos/Collaborators.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The repo collaborators API as described on -- . + module GitHub.Endpoints.Repos.Collaborators ( collaboratorsOnR, collaboratorPermissionOnR, diff --git a/src/GitHub/Endpoints/Repos/Comments.hs b/src/GitHub/Endpoints/Repos/Comments.hs index 2b853c0e..371288e3 100644 --- a/src/GitHub/Endpoints/Repos/Comments.hs +++ b/src/GitHub/Endpoints/Repos/Comments.hs @@ -1,11 +1,9 @@ {-# LANGUAGE CPP #-} ------------------------------------------------------------------------------ + -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The repo commits API as described on -- . + module GitHub.Endpoints.Repos.Comments ( commentsForR, commitCommentsForR, diff --git a/src/GitHub/Endpoints/Repos/Commits.hs b/src/GitHub/Endpoints/Repos/Commits.hs index bfe0cc84..3a10e0a9 100644 --- a/src/GitHub/Endpoints/Repos/Commits.hs +++ b/src/GitHub/Endpoints/Repos/Commits.hs @@ -1,11 +1,9 @@ {-# LANGUAGE CPP #-} ------------------------------------------------------------------------------ + -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The repo commits API as described on -- . + module GitHub.Endpoints.Repos.Commits ( CommitQueryOption(..), commitsForR, diff --git a/src/GitHub/Endpoints/Repos/Contents.hs b/src/GitHub/Endpoints/Repos/Contents.hs index 55f48c99..00d2c632 100644 --- a/src/GitHub/Endpoints/Repos/Contents.hs +++ b/src/GitHub/Endpoints/Repos/Contents.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The Github Repo Contents API, as documented at -- + module GitHub.Endpoints.Repos.Contents ( -- * Querying contents contentsForR, diff --git a/src/GitHub/Endpoints/Repos/Forks.hs b/src/GitHub/Endpoints/Repos/Forks.hs index f556e1f8..c9b56e30 100644 --- a/src/GitHub/Endpoints/Repos/Forks.hs +++ b/src/GitHub/Endpoints/Repos/Forks.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- Hot forking action, as described at -- . + module GitHub.Endpoints.Repos.Forks ( forksForR, module GitHub.Data, diff --git a/src/GitHub/Endpoints/Repos/Invitations.hs b/src/GitHub/Endpoints/Repos/Invitations.hs index 68239961..066c7abc 100644 --- a/src/GitHub/Endpoints/Repos/Invitations.hs +++ b/src/GitHub/Endpoints/Repos/Invitations.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The repo invitations API as described on -- . + module GitHub.Endpoints.Repos.Invitations ( listInvitationsOnR, listInvitationsForR, diff --git a/src/GitHub/Endpoints/Repos/Statuses.hs b/src/GitHub/Endpoints/Repos/Statuses.hs index 1c1f167d..93c4682f 100644 --- a/src/GitHub/Endpoints/Repos/Statuses.hs +++ b/src/GitHub/Endpoints/Repos/Statuses.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The repo statuses API as described on -- . + module GitHub.Endpoints.Repos.Statuses ( createStatusR, statusesForR, diff --git a/src/GitHub/Endpoints/Repos/Webhooks.hs b/src/GitHub/Endpoints/Repos/Webhooks.hs index 8b828f30..402fb4af 100644 --- a/src/GitHub/Endpoints/Repos/Webhooks.hs +++ b/src/GitHub/Endpoints/Repos/Webhooks.hs @@ -1,11 +1,8 @@ - ----------------------------------------------------------------------------- -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The webhooks API, as described at -- -- + module GitHub.Endpoints.Repos.Webhooks ( -- * Querying repositories webhooksForR, diff --git a/src/GitHub/Endpoints/Search.hs b/src/GitHub/Endpoints/Search.hs index 36b8c414..06ddd373 100644 --- a/src/GitHub/Endpoints/Search.hs +++ b/src/GitHub/Endpoints/Search.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The Github Search API, as described at -- . + module GitHub.Endpoints.Search( searchReposR, searchCodeR, diff --git a/src/GitHub/Endpoints/Users.hs b/src/GitHub/Endpoints/Users.hs index ef68bba6..85f5e68e 100644 --- a/src/GitHub/Endpoints/Users.hs +++ b/src/GitHub/Endpoints/Users.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The Github Users API, as described at -- . + module GitHub.Endpoints.Users ( userInfoForR, ownerInfoForR, diff --git a/src/GitHub/Endpoints/Users/Emails.hs b/src/GitHub/Endpoints/Users/Emails.hs index 9ba76389..c9e42520 100644 --- a/src/GitHub/Endpoints/Users/Emails.hs +++ b/src/GitHub/Endpoints/Users/Emails.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The user emails API as described on -- . + module GitHub.Endpoints.Users.Emails ( currentUserEmailsR, currentUserPublicEmailsR, diff --git a/src/GitHub/Endpoints/Users/Followers.hs b/src/GitHub/Endpoints/Users/Followers.hs index db58900f..13f8b494 100644 --- a/src/GitHub/Endpoints/Users/Followers.hs +++ b/src/GitHub/Endpoints/Users/Followers.hs @@ -1,10 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- The user followers API as described on -- . + module GitHub.Endpoints.Users.Followers ( usersFollowingR, usersFollowedByR, diff --git a/src/GitHub/Enterprise.hs b/src/GitHub/Enterprise.hs index bb64b7d7..d9474cd6 100644 --- a/src/GitHub/Enterprise.hs +++ b/src/GitHub/Enterprise.hs @@ -1,11 +1,7 @@ ------------------------------------------------------------------------------ -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- This module re-exports all request constructors and data definitions for -- working with GitHub Enterprise. --- + module GitHub.Enterprise ( -- * Enterprise Admin -- | See diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index 1994abac..23eab9d0 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -1,11 +1,9 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE CPP #-} ------------------------------------------------------------------------------ + -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- This module may change between minor releases. Do not rely on its contents. + module GitHub.Internal.Prelude ( module Prelude.Compat, -- * Commonly used types diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index 2481deea..c5eb006c 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -6,11 +6,8 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-} ------------------------------------------------------------------------------ + -- | --- License : BSD-3-Clause --- Maintainer : Oleg Grenrus --- -- This module provides data types and helper methods, which makes possible -- to build alternative API request intepreters in addition to provided -- 'IO' functions. @@ -30,6 +27,7 @@ -- > -- | Lift request into Monad -- > githubRequest :: GH.Request 'False a -> GithubMonad a -- > githubRequest = singleton + module GitHub.Request ( -- * A convenient execution of requests github, From 08b16f77a2d84186f39d8f56b1beeffcccf30eaa Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 17:01:18 +0200 Subject: [PATCH 089/121] More .gitignores --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 452bddc6..93ce2741 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .env dist dist-newstyle +/dist* +/tmp .ghc.environment.* *swp .cabal-sandbox @@ -10,7 +12,9 @@ cabal.sandbox.config *~ *.hi *.o +*.lock .stack-work run.sh src/hightlight.js src/style.css +TAGS From 69404f728e4351b8c8ebcf4206ac945cb11129a3 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 23 Jun 2023 17:47:57 +0200 Subject: [PATCH 090/121] GitHub.Internal.Prelude: simplify export list (remove duplication) --- src/GitHub/Internal/Prelude.hs | 73 +++++++++++----------------------- 1 file changed, 23 insertions(+), 50 deletions(-) diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index 23eab9d0..0419d934 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -4,56 +4,29 @@ -- | -- This module may change between minor releases. Do not rely on its contents. -module GitHub.Internal.Prelude ( - module Prelude.Compat, - -- * Commonly used types - UTCTime, - HashMap, - Text, pack, unpack, - Vector, - -- * Commonly used typeclasses - Binary, - Data, Typeable, - Generic, - Hashable(..), - IsString(..), - NFData(..), genericRnf, - Semigroup(..), - -- * Aeson - FromJSON(..), ToJSON(..), Value(..), Object, - emptyObject, - encode, - withText, withObject, (.:), (.:?), (.!=), (.=), object, typeMismatch, - -- * Control.Applicative - (<|>), - -- * Data.Maybe - catMaybes, - -- * Data.List - intercalate, toList, - -- * Data.Time.ISO8601 - formatISO8601, - ) where +module GitHub.Internal.Prelude ( module X ) where -import Control.Applicative ((<|>)) -import Control.DeepSeq (NFData (..)) -import Control.DeepSeq.Generics (genericRnf) -import Data.Aeson +import Control.Applicative as X ((<|>)) +import Control.DeepSeq as X (NFData (..)) +import Control.DeepSeq.Generics as X (genericRnf) +import Data.Aeson as X (FromJSON (..), Object, ToJSON (..), Value (..), encode, object, withObject, withText, (.!=), (.:), (.:?), (.=)) -import Data.Aeson.Types (emptyObject, typeMismatch) -import Data.Binary (Binary) -import Data.Binary.Instances () -import Data.Data (Data, Typeable) -import Data.Foldable (toList) -import Data.Hashable (Hashable (..)) -import Data.HashMap.Strict (HashMap) -import Data.List (intercalate) -import Data.Maybe (catMaybes) -import Data.Semigroup (Semigroup (..)) -import Data.String (IsString (..)) -import Data.Text (Text, pack, unpack) -import Data.Time.Compat (UTCTime) -import Data.Time.ISO8601 (formatISO8601) -import Data.Vector (Vector) -import GHC.Generics (Generic) -import Prelude.Compat +import Data.Aeson.Types as X (emptyObject, typeMismatch) +import Data.Binary as X (Binary) +import Data.Binary.Instances as X () +import Data.Data as X (Data, Typeable) +import Data.Foldable as X (toList) +import Data.Hashable as X (Hashable (..)) +import Data.HashMap.Strict as X (HashMap) +import Data.List as X (intercalate) +import Data.Maybe as X (catMaybes) +import Data.Semigroup as X (Semigroup (..)) +import Data.String as X (IsString (..)) +import Data.Text as X (Text, pack, unpack) +import Data.Time.Compat as X (UTCTime) +import Data.Time.ISO8601 as X (formatISO8601) +import Data.Vector as X (Vector) +import GHC.Generics as X (Generic) +import Prelude.Compat as X +import Data.Functor.Compat as X ((<&>)) From 5a26a8cfbfe4f00ceaf3a51d06a43d33cb39085e Mon Sep 17 00:00:00 2001 From: Oleg Nykolyn Date: Fri, 23 Jun 2023 22:46:03 -0700 Subject: [PATCH 091/121] Implement Actions API. (#459) New data structures and endpoints to access the GitHub Actions API. Commit squashed from the following commits: * Implement actions->artifacts API. * Up * Cleanup * Actions - cache. * Actions - artifacts and cache. * Secrets * Workflows. * WorkflowJobs. * WorkflowRuns. * Format * Artifacts QA. * Cache QA. * Secrets QA. * WorkflowJobs QA. * Workflows QA. * Format. * Drop slack-related files. * Format JSON * Support workflow name in workflowRunsForWorkflowR. * Support workflow name in Workflows.hs. * Fix * Fix * Do not parse pull requests from workflow runs. * Avoid parsing 'trigerring_actor', it is sometimes missing. * Fix workflow run conclusion parsing. * Whitespace and lexical changes only * Remove outdated maintainer from module headers * Whitespace: align code * Bump cabal-version to 2.4 for globbing * Cosmetics: use (<&>) * Restore upper bounds for openssl etc. in .cabal file * Whitespace * Add haddocks for WithTotalCount * Changelog for PR #459 --------- Co-authored-by: Andreas Abel --- .gitignore | 2 + CHANGELOG.md | 8 +- fixtures/actions/artifact.json | 19 + fixtures/actions/artifacts-list.json | 43 ++ fixtures/actions/cache-list.json | 14 + fixtures/actions/org-cache-usage.json | 4 + fixtures/actions/org-public-key.json | 4 + fixtures/actions/org-secrets-list.json | 18 + fixtures/actions/repo-cache-usage.json | 5 + .../selected-repositories-for-secret.json | 72 ++ fixtures/actions/workflow-job.json | 113 +++ fixtures/actions/workflow-list.json | 17 + fixtures/actions/workflow-runs-list.json | 665 ++++++++++++++++++ github.cabal | 32 +- spec/GitHub/Actions/ArtifactsSpec.hs | 66 ++ spec/GitHub/Actions/CacheSpec.hs | 53 ++ spec/GitHub/Actions/SecretsSpec.hs | 50 ++ spec/GitHub/Actions/WorkflowJobSpec.hs | 32 + spec/GitHub/Actions/WorkflowRunsSpec.hs | 32 + spec/GitHub/Actions/WorkflowSpec.hs | 32 + src/GitHub.hs | 76 ++ src/GitHub/Data.hs | 14 + src/GitHub/Data/Actions/Artifacts.hs | 76 ++ src/GitHub/Data/Actions/Cache.hs | 78 ++ src/GitHub/Data/Actions/Common.hs | 33 + src/GitHub/Data/Actions/Secrets.hs | 141 ++++ src/GitHub/Data/Actions/WorkflowJobs.hs | 98 +++ src/GitHub/Data/Actions/WorkflowRuns.hs | 91 +++ src/GitHub/Data/Actions/Workflows.hs | 62 ++ src/GitHub/Data/Options.hs | 271 +++++++ src/GitHub/Endpoints/Actions/Artifacts.hs | 61 ++ src/GitHub/Endpoints/Actions/Cache.hs | 66 ++ src/GitHub/Endpoints/Actions/Secrets.hs | 221 ++++++ src/GitHub/Endpoints/Actions/WorkflowJobs.hs | 58 ++ src/GitHub/Endpoints/Actions/WorkflowRuns.hs | 181 +++++ src/GitHub/Endpoints/Actions/Workflows.hs | 68 ++ 36 files changed, 2870 insertions(+), 6 deletions(-) create mode 100644 fixtures/actions/artifact.json create mode 100644 fixtures/actions/artifacts-list.json create mode 100644 fixtures/actions/cache-list.json create mode 100644 fixtures/actions/org-cache-usage.json create mode 100644 fixtures/actions/org-public-key.json create mode 100644 fixtures/actions/org-secrets-list.json create mode 100644 fixtures/actions/repo-cache-usage.json create mode 100644 fixtures/actions/selected-repositories-for-secret.json create mode 100644 fixtures/actions/workflow-job.json create mode 100644 fixtures/actions/workflow-list.json create mode 100644 fixtures/actions/workflow-runs-list.json create mode 100644 spec/GitHub/Actions/ArtifactsSpec.hs create mode 100644 spec/GitHub/Actions/CacheSpec.hs create mode 100644 spec/GitHub/Actions/SecretsSpec.hs create mode 100644 spec/GitHub/Actions/WorkflowJobSpec.hs create mode 100644 spec/GitHub/Actions/WorkflowRunsSpec.hs create mode 100644 spec/GitHub/Actions/WorkflowSpec.hs create mode 100644 src/GitHub/Data/Actions/Artifacts.hs create mode 100644 src/GitHub/Data/Actions/Cache.hs create mode 100644 src/GitHub/Data/Actions/Common.hs create mode 100644 src/GitHub/Data/Actions/Secrets.hs create mode 100644 src/GitHub/Data/Actions/WorkflowJobs.hs create mode 100644 src/GitHub/Data/Actions/WorkflowRuns.hs create mode 100644 src/GitHub/Data/Actions/Workflows.hs create mode 100644 src/GitHub/Endpoints/Actions/Artifacts.hs create mode 100644 src/GitHub/Endpoints/Actions/Cache.hs create mode 100644 src/GitHub/Endpoints/Actions/Secrets.hs create mode 100644 src/GitHub/Endpoints/Actions/WorkflowJobs.hs create mode 100644 src/GitHub/Endpoints/Actions/WorkflowRuns.hs create mode 100644 src/GitHub/Endpoints/Actions/Workflows.hs diff --git a/.gitignore b/.gitignore index 93ce2741..3a8f6f25 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ run.sh src/hightlight.js src/style.css TAGS +.DS_Store + diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fa91d95..0926cfee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ ## Changes for 0.29 -_2022-06-24, Andreas Abel, Midsommar edition_ +_2023-06-24, Andreas Abel, Midsommar edition_ + +- Support for the GitHub Actions API + (PR [#459](https://github.com/haskell-github/github/pull/459)): + * New endpoint modules `GitHub.EndPoints.Actions.Artifacts`, `.Cache`, + `.Secrets`, `.Workflows`, `.WorkflowRuns`, `.WorkflowJobs`. + * Matching data structure modules `GitHub.Data.Actions.*`. - Add field `issueStateReason` of type `Maybe IssueStateReason` to `Issue` with possible values `completed`, `not_planned` and `reopened` diff --git a/fixtures/actions/artifact.json b/fixtures/actions/artifact.json new file mode 100644 index 00000000..cb06b454 --- /dev/null +++ b/fixtures/actions/artifact.json @@ -0,0 +1,19 @@ +{ + "id": 416767789, + "node_id": "MDg6QXJ0aWZhY3Q0MTY3Njc3ODk=", + "name": "dist-without-markdown", + "size_in_bytes": 42718, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789", + "archive_download_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/artifacts/416767789/zip", + "expired": false, + "created_at": "2022-10-29T22:18:21Z", + "updated_at": "2022-10-29T22:18:23Z", + "expires_at": "2023-01-27T22:18:16Z", + "workflow_run": { + "id": 3353148947, + "repository_id": 559365297, + "head_repository_id": 559365297, + "head_branch": "main", + "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954" + } +} diff --git a/fixtures/actions/artifacts-list.json b/fixtures/actions/artifacts-list.json new file mode 100644 index 00000000..2d03d803 --- /dev/null +++ b/fixtures/actions/artifacts-list.json @@ -0,0 +1,43 @@ +{ + "total_count": 23809, + "artifacts": [ + { + "id": 416737084, + "node_id": "MDg6QXJ0aWZhY3Q0MTY3MzcwODQ=", + "name": "doc-html", + "size_in_bytes": 61667543, + "url": "https://api.github.com/repos/python/cpython/actions/artifacts/416737084", + "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/416737084/zip", + "expired": false, + "created_at": "2022-10-29T20:56:24Z", + "updated_at": "2022-10-29T20:56:25Z", + "expires_at": "2023-01-27T20:50:21Z", + "workflow_run": { + "id": 3352897496, + "repository_id": 81598961, + "head_repository_id": 101955313, + "head_branch": "backport-bfecff5-3.11", + "head_sha": "692cd77975413d71ff0951072df686e6f38711c8" + } + }, + { + "id": 416712612, + "node_id": "MDg6QXJ0aWZhY3Q0MTY3MTI2MTI=", + "name": "doc-html", + "size_in_bytes": 61217330, + "url": "https://api.github.com/repos/python/cpython/actions/artifacts/416712612", + "archive_download_url": "https://api.github.com/repos/python/cpython/actions/artifacts/416712612/zip", + "expired": false, + "created_at": "2022-10-29T19:53:19Z", + "updated_at": "2022-10-29T19:53:20Z", + "expires_at": "2023-01-27T19:49:12Z", + "workflow_run": { + "id": 3352724493, + "repository_id": 81598961, + "head_repository_id": 559335486, + "head_branch": "patch-1", + "head_sha": "62eb88a66d1d35f7701873d8b698a2f8d7e84fa5" + } + } + ] +} diff --git a/fixtures/actions/cache-list.json b/fixtures/actions/cache-list.json new file mode 100644 index 00000000..64cf3956 --- /dev/null +++ b/fixtures/actions/cache-list.json @@ -0,0 +1,14 @@ +{ + "total_count": 1, + "actions_caches": [ + { + "id": 1, + "ref": "refs/heads/main", + "key": "cache_key", + "version": "f5f850afdadd47730296d4ffa900de95f6bbafb75dc1e8475df1fa6ae79dcece", + "last_accessed_at": "2022-10-30T00:08:14.223333300Z", + "created_at": "2022-10-30T00:08:14.223333300Z", + "size_in_bytes": 26586 + } + ] +} diff --git a/fixtures/actions/org-cache-usage.json b/fixtures/actions/org-cache-usage.json new file mode 100644 index 00000000..99be4def --- /dev/null +++ b/fixtures/actions/org-cache-usage.json @@ -0,0 +1,4 @@ +{ + "total_active_caches_size_in_bytes": 26586, + "total_active_caches_count": 1 +} diff --git a/fixtures/actions/org-public-key.json b/fixtures/actions/org-public-key.json new file mode 100644 index 00000000..621c84eb --- /dev/null +++ b/fixtures/actions/org-public-key.json @@ -0,0 +1,4 @@ +{ + "key_id": "568250167242549743", + "key": "KHVvOxB765kjkShEgUu27QCzl5XxKz/L20V+KRsWf0w=" +} diff --git a/fixtures/actions/org-secrets-list.json b/fixtures/actions/org-secrets-list.json new file mode 100644 index 00000000..241a8737 --- /dev/null +++ b/fixtures/actions/org-secrets-list.json @@ -0,0 +1,18 @@ +{ + "total_count": 2, + "secrets": [ + { + "name": "TEST_SECRET", + "created_at": "2022-10-31T00:08:12Z", + "updated_at": "2022-10-31T00:08:12Z", + "visibility": "all" + }, + { + "name": "TEST_SELECTED", + "created_at": "2022-10-31T00:08:43Z", + "updated_at": "2022-10-31T00:08:43Z", + "visibility": "selected", + "selected_repositories_url": "https://api.github.com/orgs/kote-test-org-actions/actions/secrets/TEST_SELECTED/repositories" + } + ] +} diff --git a/fixtures/actions/repo-cache-usage.json b/fixtures/actions/repo-cache-usage.json new file mode 100644 index 00000000..bf8659be --- /dev/null +++ b/fixtures/actions/repo-cache-usage.json @@ -0,0 +1,5 @@ +{ + "full_name": "python/cpython", + "active_caches_size_in_bytes": 55000268087, + "active_caches_count": 171 +} diff --git a/fixtures/actions/selected-repositories-for-secret.json b/fixtures/actions/selected-repositories-for-secret.json new file mode 100644 index 00000000..71ce3d35 --- /dev/null +++ b/fixtures/actions/selected-repositories-for-secret.json @@ -0,0 +1,72 @@ +{ + "total_count": 1, + "repositories": [ + { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + ] +} diff --git a/fixtures/actions/workflow-job.json b/fixtures/actions/workflow-job.json new file mode 100644 index 00000000..e8e35d0f --- /dev/null +++ b/fixtures/actions/workflow-job.json @@ -0,0 +1,113 @@ +{ + "id": 9183275828, + "run_id": 3353449941, + "run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", + "run_attempt": 1, + "node_id": "CR_kwDOIVc8sc8AAAACI12rNA", + "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/jobs/9183275828", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs/5556228789", + "status": "completed", + "conclusion": "success", + "started_at": "2022-10-30T00:09:29Z", + "completed_at": "2022-10-30T00:09:49Z", + "name": "check-bats-version", + "steps": [ + { + "name": "Set up job", + "status": "completed", + "conclusion": "success", + "number": 1, + "started_at": "2022-10-29T17:09:29.000-07:00", + "completed_at": "2022-10-29T17:09:32.000-07:00" + }, + { + "name": "Run actions/checkout@v3", + "status": "completed", + "conclusion": "success", + "number": 2, + "started_at": "2022-10-29T17:09:32.000-07:00", + "completed_at": "2022-10-29T17:09:33.000-07:00" + }, + { + "name": "Run actions/setup-node@v3", + "status": "completed", + "conclusion": "success", + "number": 3, + "started_at": "2022-10-29T17:09:34.000-07:00", + "completed_at": "2022-10-29T17:09:39.000-07:00" + }, + { + "name": "Run npm install -g bats", + "status": "completed", + "conclusion": "success", + "number": 4, + "started_at": "2022-10-29T17:09:40.000-07:00", + "completed_at": "2022-10-29T17:09:42.000-07:00" + }, + { + "name": "Run bats -v", + "status": "completed", + "conclusion": "success", + "number": 5, + "started_at": "2022-10-29T17:09:42.000-07:00", + "completed_at": "2022-10-29T17:09:42.000-07:00" + }, + { + "name": "Archive Test", + "status": "completed", + "conclusion": "success", + "number": 6, + "started_at": "2022-10-29T17:09:42.000-07:00", + "completed_at": "2022-10-29T17:09:46.000-07:00" + }, + { + "name": "Cache", + "status": "completed", + "conclusion": "success", + "number": 7, + "started_at": "2022-10-29T17:09:46.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + }, + { + "name": "Post Cache", + "status": "completed", + "conclusion": "success", + "number": 12, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + }, + { + "name": "Post Run actions/setup-node@v3", + "status": "completed", + "conclusion": "success", + "number": 13, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:49.000-07:00" + }, + { + "name": "Post Run actions/checkout@v3", + "status": "completed", + "conclusion": "success", + "number": 14, + "started_at": "2022-10-29T17:09:49.000-07:00", + "completed_at": "2022-10-29T17:09:49.000-07:00" + }, + { + "name": "Complete job", + "status": "completed", + "conclusion": "success", + "number": 15, + "started_at": "2022-10-29T17:09:47.000-07:00", + "completed_at": "2022-10-29T17:09:47.000-07:00" + } + ], + "check_run_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-runs/9183275828", + "labels": [ + "ubuntu-latest" + ], + "runner_id": 1, + "runner_name": "Hosted Agent", + "runner_group_id": 2, + "runner_group_name": "GitHub Actions" +} diff --git a/fixtures/actions/workflow-list.json b/fixtures/actions/workflow-list.json new file mode 100644 index 00000000..771dcd87 --- /dev/null +++ b/fixtures/actions/workflow-list.json @@ -0,0 +1,17 @@ +{ + "total_count": 1, + "workflows": [ + { + "id": 39065091, + "node_id": "W_kwDOIVc8sc4CVBYD", + "name": "learn-github-actions", + "path": ".github/workflows/make_artifact.yaml", + "state": "active", + "created_at": "2022-10-29T15:17:59.000-07:00", + "updated_at": "2022-10-29T15:17:59.000-07:00", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "html_url": "https://github.com/kote-test-org-actions/actions-api/blob/main/.github/workflows/make_artifact.yaml", + "badge_url": "https://github.com/kote-test-org-actions/actions-api/workflows/learn-github-actions/badge.svg" + } + ] +} diff --git a/fixtures/actions/workflow-runs-list.json b/fixtures/actions/workflow-runs-list.json new file mode 100644 index 00000000..edaf5c59 --- /dev/null +++ b/fixtures/actions/workflow-runs-list.json @@ -0,0 +1,665 @@ +{ + "total_count": 3, + "workflow_runs": [ + { + "id": 3353449941, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H4ZXV", + "head_branch": "main", + "head_sha": "3156f684232a3adec5085c920d2006aca80f2798", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 3, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9030268154, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj70-g", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353449941", + "pull_requests": [], + "created_at": "2022-10-30T00:09:22Z", + "updated_at": "2022-10-30T00:09:50Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [], + "run_started_at": "2022-10-30T00:09:22Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030268154", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353449941/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "3156f684232a3adec5085c920d2006aca80f2798", + "tree_id": "f51ba8632086ca7af92f5e58c1dc98df1c62d7ce", + "message": "up", + "timestamp": "2022-10-30T00:09:16Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + }, + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + } + }, + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + }, + { + "id": 3353445625, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H4YT5", + "head_branch": "main", + "head_sha": "2d2486b9aecb80bf916717f47f7c312431d3ceb6", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 2, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9030259685, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGj7T5Q", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353445625", + "pull_requests": [], + "created_at": "2022-10-30T00:07:49Z", + "updated_at": "2022-10-30T00:08:19Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [], + "run_started_at": "2022-10-30T00:07:49Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9030259685", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353445625/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "2d2486b9aecb80bf916717f47f7c312431d3ceb6", + "tree_id": "21d858674ab650ea734b7efbf05442a21685d121", + "message": "up", + "timestamp": "2022-10-30T00:07:44Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + }, + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + } + }, + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + }, + { + "id": 3353148947, + "name": "K0Te is learning GitHub Actions", + "node_id": "WFR_kwLOIVc8sc7H3P4T", + "head_branch": "main", + "head_sha": "601593ecb1d8a57a04700fdb445a28d4186b8954", + "path": ".github/workflows/make_artifact.yaml", + "display_title": "K0Te is learning GitHub Actions", + "run_number": 1, + "event": "push", + "status": "completed", + "conclusion": "success", + "workflow_id": 39065091, + "check_suite_id": 9029740591, + "check_suite_node_id": "CS_kwDOIVc8sc8AAAACGjboLw", + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947", + "html_url": "https://github.com/kote-test-org-actions/actions-api/actions/runs/3353148947", + "pull_requests": [], + "created_at": "2022-10-29T22:18:02Z", + "updated_at": "2022-10-29T22:18:22Z", + "actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "run_attempt": 1, + "referenced_workflows": [], + "run_started_at": "2022-10-29T22:18:02Z", + "triggering_actor": { + "login": "K0Te", + "id": 6162155, + "node_id": "MDQ6VXNlcjYxNjIxNTU=", + "avatar_url": "https://avatars.githubusercontent.com/u/6162155?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/K0Te", + "html_url": "https://github.com/K0Te", + "followers_url": "https://api.github.com/users/K0Te/followers", + "following_url": "https://api.github.com/users/K0Te/following{/other_user}", + "gists_url": "https://api.github.com/users/K0Te/gists{/gist_id}", + "starred_url": "https://api.github.com/users/K0Te/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/K0Te/subscriptions", + "organizations_url": "https://api.github.com/users/K0Te/orgs", + "repos_url": "https://api.github.com/users/K0Te/repos", + "events_url": "https://api.github.com/users/K0Te/events{/privacy}", + "received_events_url": "https://api.github.com/users/K0Te/received_events", + "type": "User", + "site_admin": false + }, + "jobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/jobs", + "logs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/logs", + "check_suite_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/check-suites/9029740591", + "artifacts_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/artifacts", + "cancel_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/cancel", + "rerun_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/runs/3353148947/rerun", + "previous_attempt_url": null, + "workflow_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/actions/workflows/39065091", + "head_commit": { + "id": "601593ecb1d8a57a04700fdb445a28d4186b8954", + "tree_id": "7aa2d4e6f4e0ddb277fe2f35f7615651ee01c5a2", + "message": "test", + "timestamp": "2022-10-29T22:17:55Z", + "author": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + }, + "committer": { + "name": "Oleg Nykolyn", + "email": "juravel2@gmail.com" + } + }, + "repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + }, + "head_repository": { + "id": 559365297, + "node_id": "R_kgDOIVc8sQ", + "name": "actions-api", + "full_name": "kote-test-org-actions/actions-api", + "private": true, + "owner": { + "login": "kote-test-org-actions", + "id": 116976977, + "node_id": "O_kgDOBvjtUQ", + "avatar_url": "https://avatars.githubusercontent.com/u/116976977?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kote-test-org-actions", + "html_url": "https://github.com/kote-test-org-actions", + "followers_url": "https://api.github.com/users/kote-test-org-actions/followers", + "following_url": "https://api.github.com/users/kote-test-org-actions/following{/other_user}", + "gists_url": "https://api.github.com/users/kote-test-org-actions/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kote-test-org-actions/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kote-test-org-actions/subscriptions", + "organizations_url": "https://api.github.com/users/kote-test-org-actions/orgs", + "repos_url": "https://api.github.com/users/kote-test-org-actions/repos", + "events_url": "https://api.github.com/users/kote-test-org-actions/events{/privacy}", + "received_events_url": "https://api.github.com/users/kote-test-org-actions/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/kote-test-org-actions/actions-api", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/kote-test-org-actions/actions-api", + "forks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/forks", + "keys_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/teams", + "hooks_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/hooks", + "issue_events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/events{/number}", + "events_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/events", + "assignees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/assignees{/user}", + "branches_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/branches{/branch}", + "tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/tags", + "blobs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/statuses/{sha}", + "languages_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/languages", + "stargazers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/stargazers", + "contributors_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contributors", + "subscribers_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscribers", + "subscription_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/subscription", + "commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/contents/{+path}", + "compare_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/merges", + "archive_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/downloads", + "issues_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/issues{/number}", + "pulls_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/pulls{/number}", + "milestones_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/milestones{/number}", + "notifications_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/labels{/name}", + "releases_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/releases{/id}", + "deployments_url": "https://api.github.com/repos/kote-test-org-actions/actions-api/deployments" + } + } + ] +} diff --git a/github.cabal b/github.cabal index a0669042..5f94c430 100644 --- a/github.cabal +++ b/github.cabal @@ -1,4 +1,4 @@ -cabal-version: >=1.10 +cabal-version: 2.4 name: github version: 0.29 synopsis: Access to the GitHub API, v3. @@ -20,7 +20,7 @@ description: . For more of an overview please see the README: -license: BSD3 +license: BSD-3-Clause license-file: LICENSE author: Mike Burns, John Wiegley, Oleg Grenrus maintainer: Andreas Abel @@ -43,10 +43,12 @@ tested-with: GHC == 7.10.3 GHC == 7.8.4 -extra-source-files: +extra-doc-files: README.md CHANGELOG.md - fixtures/*.json + +extra-source-files: + fixtures/**/*.json source-repository head type: git @@ -89,6 +91,13 @@ library GitHub GitHub.Auth GitHub.Data + GitHub.Data.Actions.Common + GitHub.Data.Actions.Artifacts + GitHub.Data.Actions.Cache + GitHub.Data.Actions.Secrets + GitHub.Data.Actions.Workflows + GitHub.Data.Actions.WorkflowJobs + GitHub.Data.Actions.WorkflowRuns GitHub.Data.Activities GitHub.Data.Comments GitHub.Data.Content @@ -120,6 +129,12 @@ library GitHub.Data.URL GitHub.Data.Webhooks GitHub.Data.Webhooks.Validate + GitHub.Endpoints.Actions.Artifacts + GitHub.Endpoints.Actions.Cache + GitHub.Endpoints.Actions.Secrets + GitHub.Endpoints.Actions.Workflows + GitHub.Endpoints.Actions.WorkflowJobs + GitHub.Endpoints.Actions.WorkflowRuns GitHub.Endpoints.Activity.Events GitHub.Endpoints.Activity.Notifications GitHub.Endpoints.Activity.Starring @@ -165,7 +180,8 @@ library GitHub.Internal.Prelude GitHub.Request - other-modules: Paths_github + other-modules: Paths_github + autogen-modules: Paths_github -- Packages bundles with GHC, mtl and text are also here build-depends: @@ -222,6 +238,12 @@ test-suite github-test build-tool-depends: hspec-discover:hspec-discover >=2.7.1 && <2.12 other-extensions: TemplateHaskell other-modules: + GitHub.Actions.ArtifactsSpec + GitHub.Actions.CacheSpec + GitHub.Actions.SecretsSpec + GitHub.Actions.WorkflowJobSpec + GitHub.Actions.WorkflowRunsSpec + GitHub.Actions.WorkflowSpec GitHub.ActivitySpec GitHub.CommitsSpec GitHub.EventsSpec diff --git a/spec/GitHub/Actions/ArtifactsSpec.hs b/spec/GitHub/Actions/ArtifactsSpec.hs new file mode 100644 index 00000000..c3df8031 --- /dev/null +++ b/spec/GitHub/Actions/ArtifactsSpec.hs @@ -0,0 +1,66 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.ArtifactsSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.Either.Compat (isRight) +import Data.FileEmbed (embedFile) +import Data.Foldable (for_) +import Data.String (fromString) +import qualified Data.Vector as V +import System.Environment (lookupEnv) +import Test.Hspec + (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +withAuth :: (GH.Auth -> IO ()) -> IO () +withAuth action = do + mtoken <- lookupEnv "GITHUB_TOKEN" + case mtoken of + Nothing -> pendingWith "no GITHUB_TOKEN" + Just token -> action (GH.OAuth $ fromString token) + +spec :: Spec +spec = do + describe "artifactsForR" $ do + it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do + cs <- GH.executeRequest auth $ + GH.artifactsForR owner repo mempty GH.FetchAll + cs `shouldSatisfy` isRight + + describe "decoding artifacts payloads" $ do + it "decodes artifacts list payload" $ do + GH.withTotalCountTotalCount artifactList `shouldBe` 23809 + V.length (GH.withTotalCountItems artifactList) `shouldBe` 2 + it "decodes signle artifact payload" $ do + GH.artifactName artifact `shouldBe` "dist-without-markdown" + GH.artifactWorkflowRunHeadSha (GH.artifactWorkflowRun artifact) `shouldBe` "601593ecb1d8a57a04700fdb445a28d4186b8954" + + where + repos = + [ ("thoughtbot", "paperclip") + , ("phadej", "github") + ] + + artifactList :: GH.WithTotalCount GH.Artifact + artifactList = + fromRightS (eitherDecodeStrict artifactsListPayload) + + artifact :: GH.Artifact + artifact = + fromRightS (eitherDecodeStrict artifactPayload) + + artifactsListPayload :: ByteString + artifactsListPayload = $(embedFile "fixtures/actions/artifacts-list.json") + + artifactPayload :: ByteString + artifactPayload = $(embedFile "fixtures/actions/artifact.json") diff --git a/spec/GitHub/Actions/CacheSpec.hs b/spec/GitHub/Actions/CacheSpec.hs new file mode 100644 index 00000000..c70596c3 --- /dev/null +++ b/spec/GitHub/Actions/CacheSpec.hs @@ -0,0 +1,53 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.CacheSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import qualified Data.Vector as V +import Test.Hspec (Spec, describe, it, shouldBe) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding cache payloads" $ do + it "decodes cache list payload" $ do + V.length (GH.withTotalCountItems cacheList) `shouldBe` 1 + it "decodes cache usage for repo" $ do + GH.repositoryCacheUsageFullName repoCacheUsage `shouldBe` "python/cpython" + GH.repositoryCacheUsageActiveCachesSizeInBytes repoCacheUsage `shouldBe` 55000268087 + GH.repositoryCacheUsageActiveCachesCount repoCacheUsage `shouldBe` 171 + it "decodes cache usage for org" $ do + GH.organizationCacheUsageTotalActiveCachesSizeInBytes orgCacheUsage `shouldBe` 26586 + GH.organizationCacheUsageTotalActiveCachesCount orgCacheUsage `shouldBe` 1 + + where + cacheList :: GH.WithTotalCount GH.Cache + cacheList = + fromRightS (eitherDecodeStrict cacheListPayload) + + repoCacheUsage :: GH.RepositoryCacheUsage + repoCacheUsage = + fromRightS (eitherDecodeStrict repoCacheUsagePayload) + + orgCacheUsage :: GH.OrganizationCacheUsage + orgCacheUsage = + fromRightS (eitherDecodeStrict orgCacheUsagePayload) + + cacheListPayload :: ByteString + cacheListPayload = $(embedFile "fixtures/actions/cache-list.json") + + repoCacheUsagePayload :: ByteString + repoCacheUsagePayload = $(embedFile "fixtures/actions/repo-cache-usage.json") + + orgCacheUsagePayload :: ByteString + orgCacheUsagePayload = $(embedFile "fixtures/actions/org-cache-usage.json") diff --git a/spec/GitHub/Actions/SecretsSpec.hs b/spec/GitHub/Actions/SecretsSpec.hs new file mode 100644 index 00000000..e9e32fa0 --- /dev/null +++ b/spec/GitHub/Actions/SecretsSpec.hs @@ -0,0 +1,50 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.SecretsSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import qualified Data.Vector as V +import Test.Hspec (Spec, describe, it, shouldBe) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding secrets payloads" $ do + it "decodes selected repo list payload" $ do + V.length (GH.withTotalCountItems repoList) `shouldBe` 1 + it "decodes secret list payload" $ do + V.length (GH.withTotalCountItems orgSecretList) `shouldBe` 2 + it "decodes public key payload" $ do + GH.publicKeyId orgPublicKey `shouldBe` "568250167242549743" + + where + repoList :: GH.WithTotalCount GH.SelectedRepo + repoList = + fromRightS (eitherDecodeStrict repoListPayload) + + orgSecretList:: GH.WithTotalCount GH.OrganizationSecret + orgSecretList= + fromRightS (eitherDecodeStrict orgSecretListPayload) + + orgPublicKey:: GH.PublicKey + orgPublicKey= + fromRightS (eitherDecodeStrict orgPublicKeyPayload) + + repoListPayload :: ByteString + repoListPayload = $(embedFile "fixtures/actions/selected-repositories-for-secret.json") + + orgSecretListPayload :: ByteString + orgSecretListPayload = $(embedFile "fixtures/actions/org-secrets-list.json") + + orgPublicKeyPayload :: ByteString + orgPublicKeyPayload = $(embedFile "fixtures/actions/org-public-key.json") diff --git a/spec/GitHub/Actions/WorkflowJobSpec.hs b/spec/GitHub/Actions/WorkflowJobSpec.hs new file mode 100644 index 00000000..43334741 --- /dev/null +++ b/spec/GitHub/Actions/WorkflowJobSpec.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.WorkflowJobSpec where + +import qualified GitHub as GH +import GitHub.Data.Id + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import Test.Hspec (Spec, describe, it, shouldBe) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding workflow jobs payloads" $ do + it "decodes workflow job" $ do + GH.jobId workflowJob `shouldBe` Id 9183275828 + + where + workflowJob:: GH.Job + workflowJob= + fromRightS (eitherDecodeStrict workflowJobPayload) + + workflowJobPayload :: ByteString + workflowJobPayload = $(embedFile "fixtures/actions/workflow-job.json") diff --git a/spec/GitHub/Actions/WorkflowRunsSpec.hs b/spec/GitHub/Actions/WorkflowRunsSpec.hs new file mode 100644 index 00000000..0a5643c9 --- /dev/null +++ b/spec/GitHub/Actions/WorkflowRunsSpec.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.WorkflowRunsSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import qualified Data.Vector as V +import Test.Hspec (Spec, describe, it, shouldBe) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding workflow runs payloads" $ do + it "decodes workflow runs list" $ do + V.length (GH.withTotalCountItems workflowRunsList) `shouldBe` 3 + + where + workflowRunsList:: GH.WithTotalCount GH.WorkflowRun + workflowRunsList = + fromRightS (eitherDecodeStrict workflowRunsPayload) + + workflowRunsPayload :: ByteString + workflowRunsPayload = $(embedFile "fixtures/actions/workflow-runs-list.json") diff --git a/spec/GitHub/Actions/WorkflowSpec.hs b/spec/GitHub/Actions/WorkflowSpec.hs new file mode 100644 index 00000000..71c2aaad --- /dev/null +++ b/spec/GitHub/Actions/WorkflowSpec.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TemplateHaskell #-} +module GitHub.Actions.WorkflowSpec where + +import qualified GitHub as GH + +import Prelude () +import Prelude.Compat + +import Data.Aeson (eitherDecodeStrict) +import Data.ByteString (ByteString) +import Data.FileEmbed (embedFile) +import qualified Data.Vector as V +import Test.Hspec (Spec, describe, it, shouldBe) + +fromRightS :: Show a => Either a b -> b +fromRightS (Right b) = b +fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a + +spec :: Spec +spec = do + describe "decoding workflow payloads" $ do + it "decodes workflow list" $ do + V.length (GH.withTotalCountItems workflowList) `shouldBe` 1 + + where + workflowList:: GH.WithTotalCount GH.Workflow + workflowList = + fromRightS (eitherDecodeStrict workflowPayload) + + workflowPayload :: ByteString + workflowPayload = $(embedFile "fixtures/actions/workflow-list.json") diff --git a/src/GitHub.hs b/src/GitHub.hs index 10e34602..c3a3d88f 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -409,6 +409,76 @@ module GitHub ( -- | See rateLimitR, + -- ** Actions - artifacts + -- | See + artifactsForR, + artifactR, + deleteArtifactR, + downloadArtifactR, + artifactsForWorkflowRunR, + + -- ** Actions - cache + -- | See + cacheUsageOrganizationR, + cacheUsageByRepositoryR, + cacheUsageR, + cachesForRepoR, + deleteCacheR, + + -- ** Actions - secrets + -- | See + organizationSecretsR, + organizationPublicKeyR, + organizationSecretR, + setOrganizationSecretR, + deleteOrganizationSecretR, + organizationSelectedRepositoriesForSecretR, + setOrganizationSelectedRepositoriesForSecretR, + addOrganizationSelectedRepositoriesForSecretR, + removeOrganizationSelectedRepositoriesForSecretR, + repoSecretsR, + repoPublicKeyR, + repoSecretR, + setRepoSecretR, + deleteRepoSecretR, + environmentSecretsR, + environmentPublicKeyR, + environmentSecretR, + setEnvironmentSecretR, + deleteEnvironmentSecretR, + + -- ** Actions - workflow jobs + -- | See + jobR, + downloadJobLogsR, + jobsForWorkflowRunAttemptR, + jobsForWorkflowRunR, + + -- ** Actions - workflow runs + -- | See + reRunJobR, + workflowRunsR, + workflowRunR, + deleteWorkflowRunR, + workflowRunReviewHistoryR, + approveWorkflowRunR, + workflowRunAttemptR, + downloadWorkflowRunAttemptLogsR, + cancelWorkflowRunR, + downloadWorkflowRunLogsR, + deleteWorkflowRunLogsR, + reRunWorkflowR, + reRunFailedJobsR, + workflowRunsForWorkflowR, + + -- ** Actions - workflows + -- | See + repositoryWorkflowsR, + workflowR, + disableWorkflowR, + triggerWorkflowR, + enableWorkflowR, + -- * Data definitions module GitHub.Data, -- * Request handling @@ -416,6 +486,12 @@ module GitHub ( ) where import GitHub.Data +import GitHub.Endpoints.Actions.Artifacts +import GitHub.Endpoints.Actions.Cache +import GitHub.Endpoints.Actions.Secrets +import GitHub.Endpoints.Actions.WorkflowJobs +import GitHub.Endpoints.Actions.WorkflowRuns +import GitHub.Endpoints.Actions.Workflows import GitHub.Endpoints.Activity.Events import GitHub.Endpoints.Activity.Notifications import GitHub.Endpoints.Activity.Starring diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 4d8748f8..20ebe7fd 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -32,6 +32,13 @@ module GitHub.Data ( IssueNumber (..), -- * Module re-exports module GitHub.Auth, + module GitHub.Data.Actions.Common, + module GitHub.Data.Actions.Artifacts, + module GitHub.Data.Actions.Cache, + module GitHub.Data.Actions.Secrets, + module GitHub.Data.Actions.Workflows, + module GitHub.Data.Actions.WorkflowJobs, + module GitHub.Data.Actions.WorkflowRuns, module GitHub.Data.Activities, module GitHub.Data.Comments, module GitHub.Data.Content, @@ -65,6 +72,13 @@ import GitHub.Internal.Prelude import Prelude () import GitHub.Auth +import GitHub.Data.Actions.Common +import GitHub.Data.Actions.Artifacts +import GitHub.Data.Actions.Secrets +import GitHub.Data.Actions.Cache +import GitHub.Data.Actions.Workflows +import GitHub.Data.Actions.WorkflowJobs +import GitHub.Data.Actions.WorkflowRuns import GitHub.Data.Activities import GitHub.Data.Comments import GitHub.Data.Content diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs new file mode 100644 index 00000000..7b572d2b --- /dev/null +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -0,0 +1,76 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} + +module GitHub.Data.Actions.Artifacts ( + Artifact(..), + ArtifactWorkflowRun(..), + ) where + +import GitHub.Data.Id (Id) +import GitHub.Data.URL (URL) +import GitHub.Internal.Prelude +import Prelude () + +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) +import GitHub.Data.Repos (Repo) + +------------------------------------------------------------------------------- +-- Artifact +------------------------------------------------------------------------------- + +data ArtifactWorkflowRun = ArtifactWorkflowRun + { artifactWorkflowRunWorkflowRunId :: !(Id WorkflowRun) + , artifactWorkflowRunRepositoryId :: !(Id Repo) + , artifactWorkflowRunHeadRepositoryId :: !(Id Repo) + , artifactWorkflowRunHeadBranch :: !Text + , artifactWorkflowRunHeadSha :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data Artifact = Artifact + { artifactArchiveDownloadUrl :: !URL + , artifactCreatedAt :: !UTCTime + , artifactExpired :: !Bool + , artifactExpiresAt :: !UTCTime + , artifactId :: !(Id Artifact) + , artifactName :: !Text + , artifactNodeId :: !Text + , artifactSizeInBytes :: !Int + , artifactUpdatedAt :: !UTCTime + , artifactUrl :: !URL + , artifactWorkflowRun :: !ArtifactWorkflowRun + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON ArtifactWorkflowRun where + parseJSON = withObject "ArtifactWorkflowRun" $ \o -> ArtifactWorkflowRun + <$> o .: "id" + <*> o .: "repository_id" + <*> o .: "head_repository_id" + <*> o .: "head_branch" + <*> o .: "head_sha" + +instance FromJSON Artifact where + parseJSON = withObject "Artifact" $ \o -> Artifact + <$> o .: "archive_download_url" + <*> o .: "created_at" + <*> o .: "expired" + <*> o .: "expires_at" + <*> o .: "id" + <*> o .: "name" + <*> o .: "node_id" + <*> o .: "size_in_bytes" + <*> o .: "updated_at" + <*> o .: "url" + <*> o .: "workflow_run" + +instance FromJSON (WithTotalCount Artifact) where + parseJSON = withObject "ArtifactList" $ \o -> WithTotalCount + <$> o .: "artifacts" + <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/Cache.hs b/src/GitHub/Data/Actions/Cache.hs new file mode 100644 index 00000000..a4f65a60 --- /dev/null +++ b/src/GitHub/Data/Actions/Cache.hs @@ -0,0 +1,78 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} + +module GitHub.Data.Actions.Cache ( + Cache(..), + RepositoryCacheUsage(..), + OrganizationCacheUsage(..) + ) where + +import GitHub.Data.Id (Id) +import GitHub.Internal.Prelude +import Prelude () + +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) + +------------------------------------------------------------------------------- +-- Cache +------------------------------------------------------------------------------- + +data Cache = Cache + { cacheId :: !(Id Cache) + , cacheRef :: !Text + , cacheKey :: !Text + , cacheVersion :: !Text + , cacheLastAccessedAt :: !UTCTime + , cacheCreatedAt :: !UTCTime + , cacheSizeInBytes :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data RepositoryCacheUsage = RepositoryCacheUsage + { repositoryCacheUsageFullName :: !Text + , repositoryCacheUsageActiveCachesSizeInBytes :: !Int + , repositoryCacheUsageActiveCachesCount :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data OrganizationCacheUsage = OrganizationCacheUsage + { organizationCacheUsageTotalActiveCachesSizeInBytes :: !Int + , organizationCacheUsageTotalActiveCachesCount :: !Int + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON Cache where + parseJSON = withObject "Cache" $ \o -> Cache + <$> o .: "id" + <*> o .: "ref" + <*> o .: "key" + <*> o .: "version" + <*> o .: "last_accessed_at" + <*> o .: "created_at" + <*> o .: "size_in_bytes" + +instance FromJSON (WithTotalCount Cache) where + parseJSON = withObject "CacheList" $ \o -> WithTotalCount + <$> o .: "actions_caches" + <*> o .: "total_count" + +instance FromJSON OrganizationCacheUsage where + parseJSON = withObject "OrganizationCacheUsage" $ \o -> OrganizationCacheUsage + <$> o .: "total_active_caches_size_in_bytes" + <*> o .: "total_active_caches_count" + +instance FromJSON RepositoryCacheUsage where + parseJSON = withObject "RepositoryCacheUsage" $ \o -> RepositoryCacheUsage + <$> o .: "full_name" + <*> o .: "active_caches_size_in_bytes" + <*> o .: "active_caches_count" + +instance FromJSON (WithTotalCount RepositoryCacheUsage) where + parseJSON = withObject "CacheUsageList" $ \o -> WithTotalCount + <$> o .: "repository_cache_usages" + <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/Common.hs b/src/GitHub/Data/Actions/Common.hs new file mode 100644 index 00000000..ed02b6f0 --- /dev/null +++ b/src/GitHub/Data/Actions/Common.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} + +module GitHub.Data.Actions.Common ( + WithTotalCount(..), + ) where + +import GitHub.Internal.Prelude +import Prelude () + +------------------------------------------------------------------------------- +-- Common +------------------------------------------------------------------------------- + +-- | A page of a paginated response. +data WithTotalCount a = WithTotalCount + { withTotalCountItems :: !(Vector a) + -- ^ A snippet of the answer. + , withTotalCountTotalCount :: !Int + -- ^ The total size of the answer. + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- | Joining two pages of a paginated response. +-- The 'withTotalCountTotalCount' is assumed to be the same in both pages, +-- but this is not checked. +instance Semigroup (WithTotalCount a) where + WithTotalCount items1 count1 <> WithTotalCount items2 _ = + WithTotalCount (items1 <> items2) count1 + +instance Foldable WithTotalCount where + foldMap f (WithTotalCount items _) = foldMap f items diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs new file mode 100644 index 00000000..c734ad89 --- /dev/null +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -0,0 +1,141 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE RecordWildCards #-} + +module GitHub.Data.Actions.Secrets ( + OrganizationSecret(..), + PublicKey(..), + SetSecret(..), + SetRepoSecret(..), + SelectedRepo(..), + SetSelectedRepositories(..), + RepoSecret(..), + Environment(..), + ) where + +import GitHub.Data.Id (Id) +import GitHub.Internal.Prelude +import Prelude () + +import Data.Maybe (maybeToList) +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Name (Name) +import GitHub.Data.Repos (Repo) + +------------------------------------------------------------------------------- +-- Secret +------------------------------------------------------------------------------- + +data OrganizationSecret = OrganizationSecret + { organizationSecretName :: !(Name OrganizationSecret) + , organizationSecretCreatedAt :: !UTCTime + , organizationSecretUpdatedAt :: !UTCTime + , organizationSecretVisibility :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data PublicKey = PublicKey + { publicKeyId :: !Text + , publicKeyKey :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data SetSecret = SetSecret + { setSecretPublicKeyId :: !Text + , setSecretEncryptedValue :: !Text + , setSecretVisibility :: !Text + , setSecretSelectedRepositoryIds :: !(Maybe [Id Repo]) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data SetRepoSecret = SetRepoSecret + { setRepoSecretPublicKeyId :: !Text + , setRepoSecretEncryptedValue :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data SelectedRepo = SelectedRepo + { selectedRepoRepoId :: !(Id Repo) + , selectedRepoRepoName :: !(Name Repo) + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data SetSelectedRepositories = SetSelectedRepositories + { setSelectedRepositoriesRepositoryIds :: ![Id Repo] + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data RepoSecret = RepoSecret + { repoSecretName :: !(Name RepoSecret) + , repoSecretCreatedAt :: !UTCTime + , repoSecretUpdatedAt :: !UTCTime + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +-- TODO move somewhere else? +data Environment = Environment + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON OrganizationSecret where + parseJSON = withObject "Secret" $ \o -> OrganizationSecret + <$> o .: "name" + <*> o .: "created_at" + <*> o .: "updated_at" + <*> o .: "visibility" + +instance FromJSON (WithTotalCount OrganizationSecret) where + parseJSON = withObject "SecretList" $ \o -> WithTotalCount + <$> o .: "secrets" + <*> o .: "total_count" + +instance FromJSON PublicKey where + parseJSON = withObject "PublicKey" $ \o -> PublicKey + <$> o .: "key_id" + <*> o .: "key" + +instance FromJSON SelectedRepo where + parseJSON = withObject "SelectedRepo" $ \o -> SelectedRepo + <$> o .: "id" + <*> o .: "name" + +instance ToJSON SetSelectedRepositories where + toJSON SetSelectedRepositories{..} = + object + [ "selected_repository_ids" .= setSelectedRepositoriesRepositoryIds + ] + +instance ToJSON SetSecret where + toJSON SetSecret{..} = + object $ + [ "encrypted_value" .= setSecretEncryptedValue + , "key_id" .= setSecretPublicKeyId + , "visibility" .= setSecretVisibility + ] <> maybeToList (fmap ("selected_repository_ids" .=) setSecretSelectedRepositoryIds) + +instance ToJSON SetRepoSecret where + toJSON SetRepoSecret{..} = + object + [ "encrypted_value" .= setRepoSecretEncryptedValue + , "key_id" .= setRepoSecretPublicKeyId + ] + +instance FromJSON (WithTotalCount SelectedRepo) where + parseJSON = withObject "SelectedRepoList" $ \o -> WithTotalCount + <$> o .: "repositories" + <*> o .: "total_count" + +instance FromJSON RepoSecret where + parseJSON = withObject "RepoSecret" $ \o -> RepoSecret + <$> o .: "name" + <*> o .: "created_at" + <*> o .: "updated_at" + +instance FromJSON (WithTotalCount RepoSecret) where + parseJSON = withObject "RepoSecretList" $ \o -> WithTotalCount + <$> o .: "secrets" + <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/WorkflowJobs.hs b/src/GitHub/Data/Actions/WorkflowJobs.hs new file mode 100644 index 00000000..9698e3a9 --- /dev/null +++ b/src/GitHub/Data/Actions/WorkflowJobs.hs @@ -0,0 +1,98 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} + +module GitHub.Data.Actions.WorkflowJobs ( + JobStep(..), + Job(..), + ) where + +import Prelude () +import GitHub.Internal.Prelude + (Applicative ((<*>)), Data, Eq, FromJSON (parseJSON), Generic, Integer, + Ord, Show, Text, Typeable, UTCTime, Vector, withObject, ($), (.:), + (<$>)) + +import GitHub.Data.Id (Id) +import GitHub.Data.Name (Name) +import GitHub.Data.URL (URL) + +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Actions.WorkflowRuns (WorkflowRun) + +------------------------------------------------------------------------------- +-- Workflow jobs +------------------------------------------------------------------------------- + +data JobStep = JobStep + { jobStepName :: !(Name JobStep) + , jobStepStatus :: !Text + , jobStepConclusion :: !Text + , jobStepNumber :: !Integer + , jobStepStartedAt :: !UTCTime + , jobStepCompletedAt :: !UTCTime + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data Job = Job + { jobId :: !(Id Job) + , jobRunId :: !(Id WorkflowRun) + , jobRunUrl :: !URL + , jobRunAttempt :: !Integer + , jobNodeId :: !Text + , jobHeadSha :: !Text + , jobUrl :: !URL + , jobHtmlUrl :: !URL + , jobStatus :: !Text + , jobConclusion :: !Text + , jobStartedAt :: !UTCTime + , jobCompletedAt :: !UTCTime + , jobSteps :: !(Vector JobStep) + , jobRunCheckUrl :: !URL + , jobLabels :: !(Vector Text) + , jobRunnerId :: !Integer + , jobRunnerName :: !Text + , jobRunnerGroupId :: !Integer + , jobRunnerGroupName :: !Text + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON JobStep where + parseJSON = withObject "JobStep" $ \o -> JobStep + <$> o .: "name" + <*> o .: "status" + <*> o .: "conclusion" + <*> o .: "number" + <*> o .: "started_at" + <*> o .: "completed_at" + +instance FromJSON Job where + parseJSON = withObject "Job" $ \o -> Job + <$> o .: "id" + <*> o .: "run_id" + <*> o .: "run_url" + <*> o .: "run_attempt" + <*> o .: "node_id" + <*> o .: "head_sha" + <*> o .: "url" + <*> o .: "html_url" + <*> o .: "status" + <*> o .: "conclusion" + <*> o .: "started_at" + <*> o .: "completed_at" + <*> o .: "steps" + <*> o .: "check_run_url" + <*> o .: "labels" + <*> o .: "runner_id" + <*> o .: "runner_name" + <*> o .: "runner_group_id" + <*> o .: "runner_group_name" + +instance FromJSON (WithTotalCount Job) where + parseJSON = withObject "JobList" $ \o -> WithTotalCount + <$> o .: "jobs" + <*> o .: "total_count" diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs new file mode 100644 index 00000000..3dae581b --- /dev/null +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -0,0 +1,91 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} + +module GitHub.Data.Actions.WorkflowRuns ( + WorkflowRun(..), + RunAttempt(..), + ReviewHistory(..), + ) where + +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Definitions +import GitHub.Data.URL (URL) +import GitHub.Internal.Prelude +import Prelude () + +import GitHub.Data.Id (Id) +import GitHub.Data.Name (Name) + +------------------------------------------------------------------------------- +-- Workflow runs +------------------------------------------------------------------------------- + +data WorkflowRun = WorkflowRun + { workflowRunWorkflowRunId :: !(Id WorkflowRun) + , workflowRunName :: !(Name WorkflowRun) + , workflowRunHeadBranch :: !Text + , workflowRunHeadSha :: !Text + , workflowRunPath :: !Text + , workflowRunDisplayTitle :: !Text + , workflowRunRunNumber :: !Integer + , workflowRunEvent :: !Text + , workflowRunStatus :: !Text + , workflowRunConclusion :: !(Maybe Text) + , workflowRunWorkflowId :: !Integer + , workflowRunUrl :: !URL + , workflowRunHtmlUrl :: !URL + , workflowRunCreatedAt :: !UTCTime + , workflowRunUpdatedAt :: !UTCTime + , workflowRunActor :: !SimpleUser + , workflowRunAttempt :: !Integer + , workflowRunStartedAt :: !UTCTime + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data RunAttempt = RunAttempt + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data ReviewHistory = ReviewHistory + { reviewHistoryState :: !Text + , reviewHistoryComment :: !Text + , reviewHistoryUser :: !SimpleUser + + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON WorkflowRun where + parseJSON = withObject "WorkflowRun" $ \o -> WorkflowRun + <$> o .: "id" + <*> o .: "name" + <*> o .: "head_branch" + <*> o .: "head_sha" + <*> o .: "path" + <*> o .: "display_title" + <*> o .: "run_number" + <*> o .: "event" + <*> o .: "status" + <*> o .: "conclusion" + <*> o .: "workflow_id" + <*> o .: "url" + <*> o .: "html_url" + <*> o .: "created_at" + <*> o .: "updated_at" + <*> o .: "actor" + <*> o .: "run_attempt" + <*> o .: "run_started_at" + +instance FromJSON (WithTotalCount WorkflowRun) where + parseJSON = withObject "WorkflowRunList" $ \o -> WithTotalCount + <$> o .: "workflow_runs" + <*> o .: "total_count" + +instance FromJSON ReviewHistory where + parseJSON = withObject "ReviewHistory" $ \o -> ReviewHistory + <$> o .: "state" + <*> o .: "comment" + <*> o .: "user" diff --git a/src/GitHub/Data/Actions/Workflows.hs b/src/GitHub/Data/Actions/Workflows.hs new file mode 100644 index 00000000..9dd2252d --- /dev/null +++ b/src/GitHub/Data/Actions/Workflows.hs @@ -0,0 +1,62 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} + +module GitHub.Data.Actions.Workflows ( + Workflow(..), + CreateWorkflowDispatchEvent(..), + ) where + +import Prelude () +import GitHub.Internal.Prelude + +import GitHub.Data.Actions.Common (WithTotalCount (WithTotalCount)) +import GitHub.Data.Id (Id) +import GitHub.Data.URL (URL) + +data Workflow = Workflow + { workflowWorkflowId :: !(Id Workflow) + , workflowName :: !Text + , workflowPath :: !Text + , workflowState :: !Text + , workflowCreatedAt :: !UTCTime + , workflowUpdatedAt :: !UTCTime + , workflowUrl :: !URL + , workflowHtmlUrl :: !URL + , workflowBadgeUrl :: !URL + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +data CreateWorkflowDispatchEvent a = CreateWorkflowDispatchEvent + { createWorkflowDispatchEventRef :: !Text + , createWorkflowDispatchEventInputs :: !a + } + deriving (Show, Generic) + +instance (NFData a) => NFData (CreateWorkflowDispatchEvent a) where rnf = genericRnf +instance (Binary a) => Binary (CreateWorkflowDispatchEvent a) + +------------------------------------------------------------------------------- +-- JSON instances +------------------------------------------------------------------------------- + +instance FromJSON Workflow where + parseJSON = withObject "Workflow" $ \o -> Workflow + <$> o .: "id" + <*> o .: "name" + <*> o .: "path" + <*> o .: "state" + <*> o .: "created_at" + <*> o .: "updated_at" + <*> o .: "url" + <*> o .: "html_url" + <*> o .: "badge_url" + +instance FromJSON (WithTotalCount Workflow) where + parseJSON = withObject "WorkflowList" $ \o -> WithTotalCount + <$> o .: "workflows" + <*> o .: "total_count" + +instance ToJSON a => ToJSON (CreateWorkflowDispatchEvent a) where + toJSON (CreateWorkflowDispatchEvent ref inputs) = + object [ "ref" .= ref, "inputs" .= inputs ] diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 87c489a7..f1ce58da 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE LambdaCase #-} -- | -- Module with modifiers for pull requests' and issues' listings. @@ -46,6 +47,31 @@ module GitHub.Data.Options ( optionsAnyAssignee, optionsNoAssignee, optionsAssignee, + -- * Actions artifacts + ArtifactMod, + artifactModToQueryString, + optionsArtifactName, + -- * Actions cache + CacheMod, + cacheModToQueryString, + optionsRef, + optionsNoRef, + optionsKey, + optionsNoKey, + optionsDirectionAsc, + optionsDirectionDesc, + sortByCreatedAt, + sortByLastAccessedAt, + sortBySizeInBytes, + -- * Actions workflow runs + WorkflowRunMod, + workflowRunModToQueryString, + optionsWorkflowRunActor, + optionsWorkflowRunBranch, + optionsWorkflowRunEvent, + optionsWorkflowRunStatus, + optionsWorkflowRunCreated, + optionsWorkflowRunHeadSha, -- * Data IssueState (..), IssueStateReason (..), @@ -207,6 +233,18 @@ data FilterBy a deriving (Eq, Ord, Show, Generic, Typeable, Data) +-- Actions cache + +data SortCache + = SortCacheCreatedAt + | SortCacheLastAccessedAt + | SortCacheSizeInBytes + deriving + (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + +instance NFData SortCache where rnf = genericRnf +instance Binary SortCache + ------------------------------------------------------------------------------- -- Classes ------------------------------------------------------------------------------- @@ -663,3 +701,236 @@ optionsNoAssignee = IssueRepoMod $ \opts -> optionsAssignee :: Name User -> IssueRepoMod optionsAssignee u = IssueRepoMod $ \opts -> opts { issueRepoOptionsAssignee = FilterBy u } + +------------------------------------------------------------------------------- +-- Actions artifacts +------------------------------------------------------------------------------- + +-- | See . +data ArtifactOptions = ArtifactOptions + { artifactOptionsName :: !(Maybe Text) + } + deriving + (Eq, Ord, Show, Generic, Typeable, Data) + +defaultArtifactOptions :: ArtifactOptions +defaultArtifactOptions = ArtifactOptions + { artifactOptionsName = Nothing + } + +-- | See . +newtype ArtifactMod = ArtifactMod (ArtifactOptions -> ArtifactOptions) + +instance Semigroup ArtifactMod where + ArtifactMod f <> ArtifactMod g = ArtifactMod (g . f) + +instance Monoid ArtifactMod where + mempty = ArtifactMod id + mappend = (<>) + +-- | Filters artifacts by exact match on their name field. +optionsArtifactName :: Text -> ArtifactMod +optionsArtifactName n = ArtifactMod $ \opts -> + opts { artifactOptionsName = Just n } + +toArtifactOptions :: ArtifactMod -> ArtifactOptions +toArtifactOptions (ArtifactMod f) = f defaultArtifactOptions + +artifactModToQueryString :: ArtifactMod -> QueryString +artifactModToQueryString = artifactOptionsToQueryString . toArtifactOptions + +artifactOptionsToQueryString :: ArtifactOptions -> QueryString +artifactOptionsToQueryString (ArtifactOptions name) = + catMaybes + [ mk "name" <$> name' + ] + where + mk k v = (k, Just v) + name' = fmap TE.encodeUtf8 name + +------------------------------------------------------------------------------- +-- Actions cache +------------------------------------------------------------------------------- + +-- | See . +data CacheOptions = CacheOptions + { cacheOptionsRef :: !(Maybe Text) + , cacheOptionsKey :: !(Maybe Text) + , cacheOptionsSort :: !(Maybe SortCache) + , cacheOptionsDirection :: !(Maybe SortDirection) + } + deriving + (Eq, Ord, Show, Generic, Typeable, Data) + +defaultCacheOptions :: CacheOptions +defaultCacheOptions = CacheOptions + { cacheOptionsRef = Nothing + , cacheOptionsKey = Nothing + , cacheOptionsSort = Nothing + , cacheOptionsDirection = Nothing + } + +-- | See . +newtype CacheMod = CacheMod (CacheOptions -> CacheOptions) + +instance Semigroup CacheMod where + CacheMod f <> CacheMod g = CacheMod (g . f) + +instance Monoid CacheMod where + mempty = CacheMod id + mappend = (<>) + +toCacheOptions :: CacheMod -> CacheOptions +toCacheOptions (CacheMod f) = f defaultCacheOptions + +cacheModToQueryString :: CacheMod -> QueryString +cacheModToQueryString = cacheOptionsToQueryString . toCacheOptions + +cacheOptionsToQueryString :: CacheOptions -> QueryString +cacheOptionsToQueryString (CacheOptions ref key sort dir) = + catMaybes + [ mk "ref" <$> ref' + , mk "key" <$> key' + , mk "sort" <$> sort' + , mk "directions" <$> direction' + ] + where + mk k v = (k, Just v) + sort' = sort <&> \case + SortCacheCreatedAt -> "created_at" + SortCacheLastAccessedAt -> "last_accessed_at" + SortCacheSizeInBytes -> "size_in_bytes" + direction' = dir <&> \case + SortDescending -> "desc" + SortAscending -> "asc" + ref' = fmap TE.encodeUtf8 ref + key' = fmap TE.encodeUtf8 key + +------------------------------------------------------------------------------- +-- Cache modifiers +------------------------------------------------------------------------------- + +optionsRef :: Text -> CacheMod +optionsRef x = CacheMod $ \opts -> + opts { cacheOptionsRef = Just x } + +optionsNoRef :: CacheMod +optionsNoRef = CacheMod $ \opts -> + opts { cacheOptionsRef = Nothing } + +optionsKey :: Text -> CacheMod +optionsKey x = CacheMod $ \opts -> + opts { cacheOptionsKey = Just x } + +optionsNoKey :: CacheMod +optionsNoKey = CacheMod $ \opts -> + opts { cacheOptionsKey = Nothing } + +optionsDirectionAsc :: CacheMod +optionsDirectionAsc = CacheMod $ \opts -> + opts { cacheOptionsDirection = Just SortAscending } + +optionsDirectionDesc :: CacheMod +optionsDirectionDesc = CacheMod $ \opts -> + opts { cacheOptionsDirection = Just SortDescending } + +sortByCreatedAt :: CacheMod +sortByCreatedAt = CacheMod $ \opts -> + opts { cacheOptionsSort = Just SortCacheCreatedAt } + +sortByLastAccessedAt :: CacheMod +sortByLastAccessedAt = CacheMod $ \opts -> + opts { cacheOptionsSort = Just SortCacheLastAccessedAt } + +sortBySizeInBytes :: CacheMod +sortBySizeInBytes = CacheMod $ \opts -> + opts { cacheOptionsSort = Just SortCacheSizeInBytes } + +------------------------------------------------------------------------------- +-- Actions workflow runs +------------------------------------------------------------------------------- + +-- | See . +data WorkflowRunOptions = WorkflowRunOptions + { workflowRunOptionsActor :: !(Maybe Text) + , workflowRunOptionsBranch :: !(Maybe Text) + , workflowRunOptionsEvent :: !(Maybe Text) + , workflowRunOptionsStatus :: !(Maybe Text) + , workflowRunOptionsCreated :: !(Maybe Text) + , workflowRunOptionsHeadSha :: !(Maybe Text) + } + deriving + (Eq, Ord, Show, Generic, Typeable, Data) + +defaultWorkflowRunOptions :: WorkflowRunOptions +defaultWorkflowRunOptions = WorkflowRunOptions + { workflowRunOptionsActor = Nothing + , workflowRunOptionsBranch = Nothing + , workflowRunOptionsEvent = Nothing + , workflowRunOptionsStatus = Nothing + , workflowRunOptionsCreated = Nothing + , workflowRunOptionsHeadSha = Nothing + } + +-- | See . +newtype WorkflowRunMod = WorkflowRunMod (WorkflowRunOptions -> WorkflowRunOptions) + +instance Semigroup WorkflowRunMod where + WorkflowRunMod f <> WorkflowRunMod g = WorkflowRunMod (g . f) + +instance Monoid WorkflowRunMod where + mempty = WorkflowRunMod id + mappend = (<>) + +toWorkflowRunOptions :: WorkflowRunMod -> WorkflowRunOptions +toWorkflowRunOptions (WorkflowRunMod f) = f defaultWorkflowRunOptions + +workflowRunModToQueryString :: WorkflowRunMod -> QueryString +workflowRunModToQueryString = workflowRunOptionsToQueryString . toWorkflowRunOptions + +workflowRunOptionsToQueryString :: WorkflowRunOptions -> QueryString +workflowRunOptionsToQueryString (WorkflowRunOptions actor branch event status created headSha) = + catMaybes + [ mk "actor" <$> actor' + , mk "branch" <$> branch' + , mk "event" <$> event' + , mk "status" <$> status' + , mk "created" <$> created' + , mk "head_sha" <$> headSha' + ] + where + mk k v = (k, Just v) + actor' = fmap TE.encodeUtf8 actor + branch' = fmap TE.encodeUtf8 branch + event' = fmap TE.encodeUtf8 event + status' = fmap TE.encodeUtf8 status + created' = fmap TE.encodeUtf8 created + headSha' = fmap TE.encodeUtf8 headSha + +------------------------------------------------------------------------------- +-- Workflow run modifiers +------------------------------------------------------------------------------- + +optionsWorkflowRunActor :: Text -> WorkflowRunMod +optionsWorkflowRunActor x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsActor = Just x } + +optionsWorkflowRunBranch :: Text -> WorkflowRunMod +optionsWorkflowRunBranch x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsBranch = Just x } + +optionsWorkflowRunEvent :: Text -> WorkflowRunMod +optionsWorkflowRunEvent x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsEvent = Just x } + +optionsWorkflowRunStatus :: Text -> WorkflowRunMod +optionsWorkflowRunStatus x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsStatus = Just x } + +optionsWorkflowRunCreated :: Text -> WorkflowRunMod +optionsWorkflowRunCreated x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsCreated = Just x } + +optionsWorkflowRunHeadSha :: Text -> WorkflowRunMod +optionsWorkflowRunHeadSha x = WorkflowRunMod $ \opts -> + opts { workflowRunOptionsHeadSha = Just x } diff --git a/src/GitHub/Endpoints/Actions/Artifacts.hs b/src/GitHub/Endpoints/Actions/Artifacts.hs new file mode 100644 index 00000000..ac55dd61 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/Artifacts.hs @@ -0,0 +1,61 @@ +-- | +-- The actions API as documented at +-- . + +module GitHub.Endpoints.Actions.Artifacts ( + artifactsForR, + artifactR, + deleteArtifactR, + downloadArtifactR, + artifactsForWorkflowRunR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Network.URI (URI) +import Prelude () + +-- | List artifacts for repository. +-- See +artifactsForR + :: Name Owner + -> Name Repo + -> ArtifactMod + -> FetchCount + -> Request 'RA (WithTotalCount Artifact) +artifactsForR user repo opts = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "artifacts"] + (artifactModToQueryString opts) + +-- | Get an artifact. +-- See +artifactR :: Name Owner -> Name Repo -> Id Artifact -> Request 'RA Artifact +artifactR user repo artid = + query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid] [] + +-- | Delete an artifact. +-- See +deleteArtifactR :: Name Owner -> Name Repo -> Id Comment -> GenRequest 'MtUnit 'RW () +deleteArtifactR user repo artid = + Command Delete parts mempty + where + parts = ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid] + +-- | Download an artifact. +-- See +downloadArtifactR :: Name Owner -> Name Repo -> Id Artifact -> GenRequest 'MtRedirect 'RW URI +downloadArtifactR user repo artid = + Query ["repos", toPathPart user, toPathPart repo, "actions", "artifacts", toPathPart artid, "zip"] [] + +-- | List artifacts for a workflow run. +-- See +artifactsForWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> FetchCount + -> Request 'RA (WithTotalCount Artifact) +artifactsForWorkflowRunR user repo runid = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart runid, "artifacts"] + [] diff --git a/src/GitHub/Endpoints/Actions/Cache.hs b/src/GitHub/Endpoints/Actions/Cache.hs new file mode 100644 index 00000000..fe085420 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/Cache.hs @@ -0,0 +1,66 @@ +-- | +-- The actions API as documented at +-- . + +module GitHub.Endpoints.Actions.Cache ( + cacheUsageOrganizationR, + cacheUsageByRepositoryR, + cacheUsageR, + cachesForRepoR, + deleteCacheR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () + +-- | Get Actions cache usage for the organization. +-- See +cacheUsageOrganizationR + :: Name Organization + -> GenRequest 'MtJSON 'RA OrganizationCacheUsage +cacheUsageOrganizationR org = + Query ["orgs", toPathPart org, "actions", "cache", "usage"] [] + +-- | List repositories with GitHub Actions cache usage for an organization. +-- See +cacheUsageByRepositoryR + :: Name Organization + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount RepositoryCacheUsage) +cacheUsageByRepositoryR org = + PagedQuery ["orgs", toPathPart org, "actions", "cache", "usage-by-repository"] [] + +-- | Get GitHub Actions cache usage for a repository. +-- See +cacheUsageR + :: Name Owner + -> Name Repo + -> Request k RepositoryCacheUsage +cacheUsageR user repo = + Query ["repos", toPathPart user, toPathPart repo, "actions", "cache", "usage"] [] + +-- | List the GitHub Actions caches for a repository. +-- See +cachesForRepoR + :: Name Owner + -> Name Repo + -> CacheMod + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount Cache) +cachesForRepoR user repo opts = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "caches"] + (cacheModToQueryString opts) + +-- | Delete GitHub Actions cache for a repository. +-- See +deleteCacheR + :: Name Owner + -> Name Repo + -> Id Cache + -> GenRequest 'MtUnit 'RW () +deleteCacheR user repo cacheid = + Command Delete parts mempty + where + parts = ["repos", toPathPart user, toPathPart repo, "actions", "caches", toPathPart cacheid] diff --git a/src/GitHub/Endpoints/Actions/Secrets.hs b/src/GitHub/Endpoints/Actions/Secrets.hs new file mode 100644 index 00000000..c6b0d6b8 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/Secrets.hs @@ -0,0 +1,221 @@ +-- | +-- The actions API as documented at +-- . + +module GitHub.Endpoints.Actions.Secrets ( + organizationSecretsR, + organizationPublicKeyR, + organizationSecretR, + setOrganizationSecretR, + deleteOrganizationSecretR, + organizationSelectedRepositoriesForSecretR, + setOrganizationSelectedRepositoriesForSecretR, + addOrganizationSelectedRepositoriesForSecretR, + removeOrganizationSelectedRepositoriesForSecretR, + repoSecretsR, + repoPublicKeyR, + repoSecretR, + setRepoSecretR, + deleteRepoSecretR, + environmentSecretsR, + environmentPublicKeyR, + environmentSecretR, + setEnvironmentSecretR, + deleteEnvironmentSecretR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () + +-- | List organization secrets. +-- See +organizationSecretsR + :: Name Organization + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount OrganizationSecret) +organizationSecretsR org = + PagedQuery ["orgs", toPathPart org, "actions", "secrets"] [] + +-- | List organization secrets. +-- See +organizationPublicKeyR + :: Name Organization + -> GenRequest 'MtJSON 'RA PublicKey +organizationPublicKeyR org = + Query ["orgs", toPathPart org, "actions", "secrets", "public-key"] [] + +-- | Get an organization secret. +-- See +organizationSecretR + :: Name Organization + -> Name OrganizationSecret + -> GenRequest 'MtJSON 'RA OrganizationSecret +organizationSecretR org name = + Query ["orgs", toPathPart org, "actions", "secrets", toPathPart name] [] + +-- | Create or update an organization secret. +-- See +setOrganizationSecretR + :: Name Organization + -> Name OrganizationSecret + -> SetSecret + -> GenRequest 'MtUnit 'RW () +setOrganizationSecretR org name = + Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name] . encode + +-- | Delete an organization secret. +-- See +deleteOrganizationSecretR + :: Name Organization + -> Name OrganizationSecret + -> GenRequest 'MtUnit 'RW () +deleteOrganizationSecretR org name = + Command Delete parts mempty + where + parts = ["orgs", toPathPart org, "actions", "secrets", toPathPart name] + +-- | Get selected repositories for an organization secret. +-- See +organizationSelectedRepositoriesForSecretR + :: Name Organization + -> Name OrganizationSecret + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount SelectedRepo) +organizationSelectedRepositoriesForSecretR org name = + PagedQuery ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] [] + +-- | Set selected repositories for an organization secret. +-- See +setOrganizationSelectedRepositoriesForSecretR + :: Name Organization + -> Name OrganizationSecret + -> SetSelectedRepositories + -> GenRequest 'MtUnit 'RW () +setOrganizationSelectedRepositoriesForSecretR org name = + Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories"] . encode + +-- | Add selected repository to an organization secret. +-- See +addOrganizationSelectedRepositoriesForSecretR + :: Name Organization + -> Name OrganizationSecret + -> Id Repo + -> GenRequest 'MtUnit 'RW () +addOrganizationSelectedRepositoriesForSecretR org name repo = + Command Put ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty + +-- | Remove selected repository from an organization secret. +-- See +removeOrganizationSelectedRepositoriesForSecretR + :: Name Organization + -> Name OrganizationSecret + -> Id Repo + -> GenRequest 'MtUnit 'RW () +removeOrganizationSelectedRepositoriesForSecretR org name repo = + Command Delete ["orgs", toPathPart org, "actions", "secrets", toPathPart name, "repositories", toPathPart repo] mempty + +-- | List repository secrets. +-- See +repoSecretsR + :: Name Owner + -> Name Repo + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret) +repoSecretsR user repo = + PagedQuery ["repos", toPathPart user, toPathPart repo, "actions", "secrets"] [] + +-- | Get a repository public key. +-- See +repoPublicKeyR + :: Name Owner + -> Name Organization + -> GenRequest 'MtJSON 'RA PublicKey +repoPublicKeyR user org = + Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", "public-key"] [] + +-- | Get a repository secret. +-- See +repoSecretR + :: Name Owner + -> Name Organization + -> Name RepoSecret + -> GenRequest 'MtJSON 'RA RepoSecret +repoSecretR user org name = + Query ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] [] + +-- | Create or update a repository secret. +-- See +setRepoSecretR + :: Name Owner + -> Name Organization + -> Name RepoSecret + -> SetRepoSecret + -> GenRequest 'MtUnit 'RW () +setRepoSecretR user org name = + Command Put ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] . encode + +-- | Delete a repository secret. +-- See +deleteRepoSecretR + :: Name Owner + -> Name Organization + -> Name RepoSecret + -> GenRequest 'MtUnit 'RW () +deleteRepoSecretR user org name = + Command Delete parts mempty + where + parts = ["repos", toPathPart user, toPathPart org, "actions", "secrets", toPathPart name] + +-- | List environment secrets. +-- See +environmentSecretsR + :: Id Repo + -> Name Environment + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount RepoSecret) +environmentSecretsR repo env = + PagedQuery ["repositories", toPathPart repo, "environments", toPathPart env, "secrets"] [] + +-- | Get an environment public key. +-- See +environmentPublicKeyR + :: Id Repo + -> Name Environment + -> GenRequest 'MtJSON 'RA PublicKey +environmentPublicKeyR repo env = + Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", "public-key"] [] + +-- | Get an environment secret +-- See +environmentSecretR + :: Id Repo + -> Name Environment + -> Name RepoSecret + -> GenRequest 'MtJSON 'RA RepoSecret +environmentSecretR repo env name = + Query ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] [] + +-- | Create or update an environment secret. +-- See +setEnvironmentSecretR + :: Id Repo + -> Name Environment + -> Name RepoSecret + -> SetRepoSecret + -> GenRequest 'MtUnit 'RW () +setEnvironmentSecretR repo env name = + Command Put ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] . encode + +-- | Delete an environment secret. +-- See +deleteEnvironmentSecretR + :: Id Repo + -> Name Environment + -> Name RepoSecret + -> GenRequest 'MtUnit 'RW () +deleteEnvironmentSecretR repo env name = + Command Delete parts mempty + where + parts = ["repositories", toPathPart repo, "environments", toPathPart env, "secrets", toPathPart name] diff --git a/src/GitHub/Endpoints/Actions/WorkflowJobs.hs b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs new file mode 100644 index 00000000..881803b4 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/WorkflowJobs.hs @@ -0,0 +1,58 @@ +-- | +-- The actions API as documented at +-- . + +module GitHub.Endpoints.Actions.WorkflowJobs ( + jobR, + downloadJobLogsR, + jobsForWorkflowRunAttemptR, + jobsForWorkflowRunR, + module GitHub.Data + ) where + +import GitHub.Data +import Network.URI (URI) +import Prelude () + +-- | Get a job for a workflow run. +-- See +jobR + :: Name Owner + -> Name Repo + -> Id Job + -> Request 'RA Job +jobR owner repo job = + Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job] [] + +-- | Download job logs for a workflow run. +-- See +downloadJobLogsR + :: Name Owner + -> Name Repo + -> Id Job + -> GenRequest 'MtRedirect 'RO URI +downloadJobLogsR owner repo job = + Query ["repos", toPathPart owner, toPathPart repo, "actions", "jobs", toPathPart job, "logs"] [] + +-- | List jobs for a workflow run attempt. +-- See +jobsForWorkflowRunAttemptR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> Id RunAttempt + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount Job) +jobsForWorkflowRunAttemptR owner repo run attempt = + PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt, "jobs"] [] + +-- | List jobs for a workflow run. +-- See +jobsForWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount Job) +jobsForWorkflowRunR owner repo run = + PagedQuery ["repos", toPathPart owner, toPathPart repo, "actions", "runs", toPathPart run, "jobs"] [] diff --git a/src/GitHub/Endpoints/Actions/WorkflowRuns.hs b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs new file mode 100644 index 00000000..3039323d --- /dev/null +++ b/src/GitHub/Endpoints/Actions/WorkflowRuns.hs @@ -0,0 +1,181 @@ +module GitHub.Endpoints.Actions.WorkflowRuns ( + reRunJobR, + workflowRunsR, + workflowRunR, + deleteWorkflowRunR, + workflowRunReviewHistoryR, + approveWorkflowRunR, + workflowRunAttemptR, + downloadWorkflowRunAttemptLogsR, + cancelWorkflowRunR, + downloadWorkflowRunLogsR, + deleteWorkflowRunLogsR, + reRunWorkflowR, + reRunFailedJobsR, + workflowRunsForWorkflowR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Network.URI (URI) +import Prelude () + +-- | Re-run a job from a workflow run. +-- See +reRunJobR + :: Name Owner + -> Name Repo + -> Id Job + -> GenRequest 'MtUnit 'RW () +reRunJobR user repo job = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "jobs", toPathPart job, "rerun"] + mempty + +-- | List workflow runs for a repository. +-- See +workflowRunsR + :: Name Owner + -> Name Repo + -> WorkflowRunMod + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) +workflowRunsR user repo runMod = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "runs"] + (workflowRunModToQueryString runMod) + +-- | Get a workflow run. +-- See +workflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtJSON 'RA WorkflowRun +workflowRunR user repo run = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] + [] + +-- | Delete a workflow run. +-- See +deleteWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtUnit 'RW () +deleteWorkflowRunR user repo run = Command Delete + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run] + mempty + +-- | Get the review history for a workflow run. +-- See +workflowRunReviewHistoryR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtJSON 'RA (Vector ReviewHistory) +workflowRunReviewHistoryR user repo run = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approvals"] + [] + +-- | Approve a workflow run for a fork pull request. +-- See +approveWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtUnit 'RW () +approveWorkflowRunR user repo run = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "approve"] + mempty + +-- | Get a workflow run attempt. +-- See +workflowRunAttemptR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> Id RunAttempt + -> GenRequest 'MtJSON 'RA WorkflowRun +workflowRunAttemptR user repo run attempt = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt] + [] + +-- | Download workflow run attempt logs. +-- See +downloadWorkflowRunAttemptLogsR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> Id RunAttempt + -> GenRequest 'MtRedirect 'RO URI +downloadWorkflowRunAttemptLogsR user repo run attempt = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "attempts", toPathPart attempt, "logs"] + [] + +-- | Cancel a workflow run. +-- See +cancelWorkflowRunR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtUnit 'RW () +cancelWorkflowRunR user repo run = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "cancel"] + mempty + +-- | Download workflow run logs. +-- See +downloadWorkflowRunLogsR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtRedirect 'RA URI +downloadWorkflowRunLogsR user repo run = Query + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"] + [] + +-- | Delete workflow run logs. +-- See +deleteWorkflowRunLogsR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtUnit 'RW () +deleteWorkflowRunLogsR user repo run = Command Delete + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "logs"] + mempty + +-- | Re-run a workflow. +-- See +reRunWorkflowR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtUnit 'RW () +reRunWorkflowR user repo run = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun"] + mempty + +-- | Re-run failed jobs from a workflow run. +-- See +reRunFailedJobsR + :: Name Owner + -> Name Repo + -> Id WorkflowRun + -> GenRequest 'MtUnit 'RW () +reRunFailedJobsR user repo run = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "runs", toPathPart run, "rerun-failed-jobs"] + mempty + +-- | List workflow runs for a workflow. +-- See +workflowRunsForWorkflowR + :: (IsPathPart idOrName) => Name Owner + -> Name Repo + -> idOrName + -> WorkflowRunMod + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount WorkflowRun) +workflowRunsForWorkflowR user repo idOrName runMod = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "runs"] + (workflowRunModToQueryString runMod) diff --git a/src/GitHub/Endpoints/Actions/Workflows.hs b/src/GitHub/Endpoints/Actions/Workflows.hs new file mode 100644 index 00000000..998a88b4 --- /dev/null +++ b/src/GitHub/Endpoints/Actions/Workflows.hs @@ -0,0 +1,68 @@ +module GitHub.Endpoints.Actions.Workflows ( + repositoryWorkflowsR, + workflowR, + disableWorkflowR, + triggerWorkflowR, + enableWorkflowR, + module GitHub.Data + ) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () + +-- | List repository workflows. +-- See +repositoryWorkflowsR + :: Name Owner + -> Name Repo + -> FetchCount + -> GenRequest 'MtJSON 'RA (WithTotalCount Workflow) +repositoryWorkflowsR user repo = PagedQuery + ["repos", toPathPart user, toPathPart repo, "actions", "workflows"] + [] + +-- | Get a workflow. +-- See +workflowR + :: (IsPathPart idOrName) => Name Owner + -> Name Repo + -> idOrName + -> GenRequest 'MtJSON 'RA Workflow +workflowR user repo idOrName = Query + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName] + [] + +-- | Disable a workflow. +-- See +disableWorkflowR + :: (IsPathPart idOrName) => Name Owner + -> Name Repo + -> idOrName + -> GenRequest 'MtUnit 'RW () +disableWorkflowR user repo idOrName = Command Put + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "disable"] + mempty + +-- | Create a workflow dispatch event. +-- See +triggerWorkflowR + :: (ToJSON a, IsPathPart idOrName) => Name Owner + -> Name Repo + -> idOrName + -> CreateWorkflowDispatchEvent a + -> GenRequest 'MtUnit 'RW () +triggerWorkflowR user repo idOrName = Command Post + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "dispatches"] + . encode + +-- | Enable a workflow. +-- See +enableWorkflowR + :: (IsPathPart idOrName) => Name Owner + -> Name Repo + -> idOrName + -> GenRequest 'MtUnit 'RW () +enableWorkflowR user repo idOrName = Command Put + ["repos", toPathPart user, toPathPart repo, "actions", "workflows", toPathPart idOrName, "enable"] + mempty From f701d4108eb9f68277ccba9b2a9dade443899ae3 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 27 Jun 2023 22:45:06 +0200 Subject: [PATCH 092/121] v0.29 revision 1: allow aeson-2.2 --- github.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github.cabal b/github.cabal index 5f94c430..e8dd34aa 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,7 @@ cabal-version: 2.4 name: github version: 0.29 +x-revision: 1 synopsis: Access to the GitHub API, v3. category: Network description: @@ -197,7 +198,7 @@ library -- other packages build-depends: - aeson >=1.4.0.0 && <1.6 || >=2.0.1.0 && <2.2 + aeson >=1.4.0.0 && <1.6 || >=2.0.1.0 && <2.3 , base-compat >=0.11.1 && <0.14 , base16-bytestring >=0.1.1.6 && <1.1 , binary-instances >=1 && <1.1 From d94e93a7aa0f5345b510be4b7949420cd7879eb5 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sun, 16 Jul 2023 20:27:39 +0200 Subject: [PATCH 093/121] v0.29 revision 2: allow bytestring-0.12 --- github.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github.cabal b/github.cabal index e8dd34aa..6c3b1d76 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,7 @@ cabal-version: 2.4 name: github version: 0.29 -x-revision: 1 +x-revision: 2 synopsis: Access to the GitHub API, v3. category: Network description: @@ -188,7 +188,7 @@ library build-depends: base >=4.7 && <5 , binary >=0.7.1.0 && <0.11 - , bytestring >=0.10.4.0 && <0.12 + , bytestring >=0.10.4.0 && <0.13 , containers >=0.5.5.1 && <0.7 , deepseq >=1.3.0.2 && <1.5 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.4 From 7ba08645b601195c227c4b2491fc2b84549364ab Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Thu, 3 Aug 2023 12:13:44 +0200 Subject: [PATCH 094/121] v0.29-r3: allow deepseq-1.5 for GHC 9.8 --- github.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github.cabal b/github.cabal index 6c3b1d76..69b1ffbf 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,7 @@ cabal-version: 2.4 name: github version: 0.29 -x-revision: 2 +x-revision: 3 synopsis: Access to the GitHub API, v3. category: Network description: @@ -190,7 +190,8 @@ library , binary >=0.7.1.0 && <0.11 , bytestring >=0.10.4.0 && <0.13 , containers >=0.5.5.1 && <0.7 - , deepseq >=1.3.0.2 && <1.5 + , deepseq >=1.3.0.2 && <1.6 + , exceptions >=0.10.2 && <0.11 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.4 , text >=1.2.0.6 && <2.1 , time-compat >=1.9.2.2 && <1.10 @@ -204,7 +205,6 @@ library , binary-instances >=1 && <1.1 , cryptohash-sha1 >=0.11.100.1 && <0.12 , deepseq-generics >=0.2.0.0 && <0.3 - , exceptions >=0.10.2 && <0.11 , hashable >=1.2.7.0 && <1.5 , http-client >=0.5.12 && <0.8 , http-link-header >=1.0.3.1 && <1.3 From c0ce867ce3fc8368173f8698a67e533924b97f75 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Sat, 30 Sep 2023 12:59:19 +0200 Subject: [PATCH 095/121] v0.29-r4: allow containers-0.7 and text-2.1 The former is also tested by a constraint-set in CI. (The latter cannot atm because of aeson's incompatibility with text-2.1.) --- .github/workflows/haskell-ci.yml | 72 ++++++++++++++++++++++---------- cabal.haskell-ci | 13 +++++- github.cabal | 12 +++--- samples/github-samples.cabal | 5 ++- 4 files changed, 70 insertions(+), 32 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index b5d24eb9..64853c33 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -6,22 +6,20 @@ # # haskell-ci regenerate # -# For more information, see https://github.com/haskell-CI/haskell-ci +# For more information, see https://github.com/andreasabel/haskell-ci # -# version: 0.16.4 +# version: 0.17.20230928 # -# REGENDATA ("0.16.4",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.17.20230928",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: push: branches: - master - - ci* pull_request: branches: - master - - ci* jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} @@ -29,19 +27,24 @@ jobs: timeout-minutes: 60 container: - image: buildpack-deps:bionic + image: buildpack-deps:focal continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: - - compiler: ghc-9.6.2 + - compiler: ghc-9.8.0.20230919 compilerKind: ghc - compilerVersion: 9.6.2 + compilerVersion: 9.8.0.20230919 + setup-method: ghcup + allow-failure: true + - compiler: ghc-9.6.3 + compilerKind: ghc + compilerVersion: 9.6.3 setup-method: ghcup allow-failure: false - - compiler: ghc-9.4.5 + - compiler: ghc-9.4.7 compilerKind: ghc - compilerVersion: 9.4.5 + compilerVersion: 9.4.7 setup-method: ghcup allow-failure: false - compiler: ghc-9.2.8 @@ -89,11 +92,6 @@ jobs: compilerVersion: 7.10.3 setup-method: hvr-ppa allow-failure: false - - compiler: ghc-7.8.4 - compilerKind: ghc - compilerVersion: 7.8.4 - setup-method: hvr-ppa - allow-failure: false fail-fast: false steps: - name: apt @@ -102,8 +100,9 @@ jobs: apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 if [ "${{ matrix.setup-method }}" = ghcup ]; then mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) else @@ -111,8 +110,9 @@ jobs: apt-get update apt-get install -y "$HCNAME" mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: @@ -127,10 +127,12 @@ jobs: echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER if [ "${{ matrix.setup-method }}" = ghcup ]; then - HC=$HOME/.ghcup/bin/$HCKIND-$HCVER + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" - echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" else HC=$HCDIR/bin/$HCKIND @@ -144,7 +146,7 @@ jobs: echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + if [ $((HCNUMVER >= 90800)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -173,6 +175,18 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + if $HEADHACKAGE; then + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project + fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local @@ -273,6 +291,16 @@ jobs: run: | rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: prepare for constraint sets + run: | + rm -f cabal.project.local + - name: constraint set containers-0.7 + run: | + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' all --dry-run ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then cabal-plan topo | sort ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' --dependencies-only -j2 all ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' all ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' all ; fi - name: save cache uses: actions/cache/save@v3 if: always() diff --git a/cabal.haskell-ci b/cabal.haskell-ci index a3ce9738..6c697b60 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -1,4 +1,4 @@ -branches: master ci* +branches: master haddock: >=8.6 -- See PR #355: haddocks for GADT constructor arguments only supported from GHC 8.6 jobs-selection: any @@ -10,4 +10,13 @@ jobs-selection: any -- constraint-set text-2.0 -- constraints: text >= 2.0 --- allow-newer: *:text -- allow-newer not supported \ No newline at end of file +-- allow-newer: *:text -- allow-newer not supported + +constraint-set containers-0.7 + ghc: >= 9 + constraints: containers >= 0.7 + tests: True + run-tests: True + +raw-project + allow-newer: containers diff --git a/github.cabal b/github.cabal index 69b1ffbf..225c6c17 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,7 @@ cabal-version: 2.4 name: github version: 0.29 -x-revision: 3 +x-revision: 4 synopsis: Access to the GitHub API, v3. category: Network description: @@ -31,8 +31,9 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC == 9.6.2 - GHC == 9.4.5 + GHC == 9.8.0 + GHC == 9.6.3 + GHC == 9.4.7 GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 @@ -42,7 +43,6 @@ tested-with: GHC == 8.2.2 GHC == 8.0.2 GHC == 7.10.3 - GHC == 7.8.4 extra-doc-files: README.md @@ -189,11 +189,11 @@ library base >=4.7 && <5 , binary >=0.7.1.0 && <0.11 , bytestring >=0.10.4.0 && <0.13 - , containers >=0.5.5.1 && <0.7 + , containers >=0.5.5.1 && <0.8 , deepseq >=1.3.0.2 && <1.6 , exceptions >=0.10.2 && <0.11 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.4 - , text >=1.2.0.6 && <2.1 + , text >=1.2.0.6 && <2.2 , time-compat >=1.9.2.2 && <1.10 , transformers >=0.3.0.0 && <0.7 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index c3c6813d..3686dcfd 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,8 +10,9 @@ description: Various samples of github package build-type: Simple tested-with: - GHC == 9.6.2 - GHC == 9.4.5 + GHC == 9.8.0 + GHC == 9.6.3 + GHC == 9.4.7 GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 From 6b9716c1d397248aa8394d04b386fe763053dcdd Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 17 Oct 2023 09:29:06 +0200 Subject: [PATCH 096/121] Bump Haskell-CI to GHC 9.8.1 --- .github/workflows/haskell-ci.yml | 39 ++++++++++---------------------- github.cabal | 2 +- samples/github-samples.cabal | 2 +- 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 64853c33..5574ac10 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/andreasabel/haskell-ci # -# version: 0.17.20230928 +# version: 0.17.20231012 # -# REGENDATA ("0.17.20230928",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.17.20231012",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -32,11 +32,11 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.8.0.20230919 + - compiler: ghc-9.8.1 compilerKind: ghc - compilerVersion: 9.8.0.20230919 + compilerVersion: 9.8.1 setup-method: ghcup - allow-failure: true + allow-failure: false - compiler: ghc-9.6.3 compilerKind: ghc compilerVersion: 9.6.3 @@ -65,27 +65,27 @@ jobs: - compiler: ghc-8.8.4 compilerKind: ghc compilerVersion: 8.8.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.6.5 compilerKind: ghc compilerVersion: 8.6.5 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.4.4 compilerKind: ghc compilerVersion: 8.4.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.2.2 compilerKind: ghc compilerVersion: 8.2.2 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.0.2 compilerKind: ghc compilerVersion: 8.0.2 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-7.10.3 compilerKind: ghc @@ -97,7 +97,7 @@ jobs: - name: apt run: | apt-get update - apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev if [ "${{ matrix.setup-method }}" = ghcup ]; then mkdir -p "$HOME/.ghcup/bin" curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" @@ -146,7 +146,7 @@ jobs: echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - if [ $((HCNUMVER >= 90800)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: @@ -175,18 +175,6 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF - if $HEADHACKAGE; then - cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project - fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local diff --git a/github.cabal b/github.cabal index 225c6c17..cde8b8ff 100644 --- a/github.cabal +++ b/github.cabal @@ -31,7 +31,7 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC == 9.8.0 + GHC == 9.8.1 GHC == 9.6.3 GHC == 9.4.7 GHC == 9.2.8 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 3686dcfd..166a0ce0 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,7 +10,7 @@ description: Various samples of github package build-type: Simple tested-with: - GHC == 9.8.0 + GHC == 9.8.1 GHC == 9.6.3 GHC == 9.4.7 GHC == 9.2.8 From ee8b28628552efa230d6a194d2f342e7305e56f8 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 24 May 2024 00:05:53 +0200 Subject: [PATCH 097/121] Allow base-compat<1, hashable<2, bump CI to GHC 9.10.1 --- .github/workflows/haskell-ci.yml | 88 +++++++++++--------------------- github.cabal | 18 ++++--- samples/github-samples.cabal | 7 +-- 3 files changed, 45 insertions(+), 68 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 5574ac10..738964dc 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/andreasabel/haskell-ci # -# version: 0.17.20231012 +# version: 0.19.20240703 # -# REGENDATA ("0.17.20231012",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.19.20240703",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -27,24 +27,29 @@ jobs: timeout-minutes: 60 container: - image: buildpack-deps:focal + image: buildpack-deps:jammy continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: - - compiler: ghc-9.8.1 + - compiler: ghc-9.10.1 compilerKind: ghc - compilerVersion: 9.8.1 + compilerVersion: 9.10.1 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.3 + - compiler: ghc-9.8.2 compilerKind: ghc - compilerVersion: 9.6.3 + compilerVersion: 9.8.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.4.7 + - compiler: ghc-9.6.6 compilerKind: ghc - compilerVersion: 9.4.7 + compilerVersion: 9.6.6 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.4.8 + compilerKind: ghc + compilerVersion: 9.4.8 setup-method: ghcup allow-failure: false - compiler: ghc-9.2.8 @@ -82,39 +87,17 @@ jobs: compilerVersion: 8.2.2 setup-method: ghcup allow-failure: false - - compiler: ghc-8.0.2 - compilerKind: ghc - compilerVersion: 8.0.2 - setup-method: ghcup - allow-failure: false - - compiler: ghc-7.10.3 - compilerKind: ghc - compilerVersion: 7.10.3 - setup-method: hvr-ppa - allow-failure: false fail-fast: false steps: - name: apt run: | apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev - if [ "${{ matrix.setup-method }}" = ghcup ]; then - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; - "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - else - apt-add-repository -y 'ppa:hvr/ghc' - apt-get update - apt-get install -y "$HCNAME" - mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - fi + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -126,22 +109,13 @@ jobs: echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER - if [ "${{ matrix.setup-method }}" = ghcup ]; then - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" - else - HC=$HCDIR/bin/$HCKIND - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" - echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" - fi - + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" @@ -226,8 +200,8 @@ jobs: touch cabal.project.local echo "packages: ${PKGDIR_github}" >> cabal.project if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + echo "package github" >> cabal.project + echo " ghc-options: -Werror=missing-methods" >> cabal.project if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -245,7 +219,7 @@ jobs: $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - name: restore cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -287,7 +261,7 @@ jobs: if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' all ; fi if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' all ; fi - name: save cache - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 if: always() with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} diff --git a/github.cabal b/github.cabal index cde8b8ff..eb835470 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,7 @@ cabal-version: 2.4 name: github version: 0.29 -x-revision: 4 +x-revision: 5 synopsis: Access to the GitHub API, v3. category: Network description: @@ -31,9 +31,10 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC == 9.8.1 - GHC == 9.6.3 - GHC == 9.4.7 + GHC == 9.10.1 + GHC == 9.8.2 + GHC == 9.6.6 + GHC == 9.4.8 GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 @@ -41,8 +42,9 @@ tested-with: GHC == 8.6.5 GHC == 8.4.4 GHC == 8.2.2 - GHC == 8.0.2 - GHC == 7.10.3 + -- Build failure of HsOpenSSL with GHC 8.0 + -- https://github.com/haskell-cryptography/HsOpenSSL/issues/97 + -- GHC == 8.0.2 extra-doc-files: README.md @@ -200,12 +202,12 @@ library -- other packages build-depends: aeson >=1.4.0.0 && <1.6 || >=2.0.1.0 && <2.3 - , base-compat >=0.11.1 && <0.14 + , base-compat >=0.11.1 && <1 , base16-bytestring >=0.1.1.6 && <1.1 , binary-instances >=1 && <1.1 , cryptohash-sha1 >=0.11.100.1 && <0.12 , deepseq-generics >=0.2.0.0 && <0.3 - , hashable >=1.2.7.0 && <1.5 + , hashable >=1.2.7.0 && <2 , http-client >=0.5.12 && <0.8 , http-link-header >=1.0.3.1 && <1.3 , http-types >=0.12.3 && <0.13 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 166a0ce0..ced03e5e 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,9 +10,10 @@ description: Various samples of github package build-type: Simple tested-with: - GHC == 9.8.1 - GHC == 9.6.3 - GHC == 9.4.7 + GHC == 9.10.1 + GHC == 9.8.2 + GHC == 9.6.6 + GHC == 9.4.8 GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 From 415e4748bf5d38434ae143a3520d3bc6d5c27cdf Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Thu, 17 Oct 2024 22:28:09 +0200 Subject: [PATCH 098/121] Drop support for GHC 8.0 and below --- CHANGELOG.md | 7 +++++++ github.cabal | 21 ++++++--------------- samples/Operational/Operational.hs | 2 +- src/GitHub/Data.hs | 2 -- src/GitHub/Data/Name.hs | 5 ----- src/GitHub/Data/RateLimit.hs | 2 +- src/GitHub/Data/Repos.hs | 22 ---------------------- src/GitHub/Data/Request.hs | 1 - src/GitHub/Endpoints/Issues.hs | 2 -- src/GitHub/Endpoints/Repos/Comments.hs | 2 -- src/GitHub/Endpoints/Repos/Commits.hs | 2 -- src/GitHub/Internal/Prelude.hs | 3 +-- 12 files changed, 16 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0926cfee..e090d021 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## Changes for 0.29.1 + +- Drop support for GHC 8.0 and below. +- Drop dependency `time-compat`. + +Tested with GHC 8.2 - 9.10.1. + ## Changes for 0.29 _2023-06-24, Andreas Abel, Midsommar edition_ diff --git a/github.cabal b/github.cabal index eb835470..d4d2d930 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,6 @@ cabal-version: 2.4 name: github -version: 0.29 -x-revision: 5 +version: 0.29.1 synopsis: Access to the GitHub API, v3. category: Network description: @@ -42,9 +41,6 @@ tested-with: GHC == 8.6.5 GHC == 8.4.4 GHC == 8.2.2 - -- Build failure of HsOpenSSL with GHC 8.0 - -- https://github.com/haskell-cryptography/HsOpenSSL/issues/97 - -- GHC == 8.0.2 extra-doc-files: README.md @@ -66,11 +62,9 @@ library default-language: Haskell2010 ghc-options: -Wall - if impl(ghc >= 8.0) - ghc-options: - -Wcompat - -Wno-star-is-type - -- The star-is-type warning cannot be sensiblity addressed while supporting GHC 7. + -Wcompat + -Wno-star-is-type + -- The star-is-type warning cannot be sensiblity addressed while supporting GHC 7. hs-source-dirs: src default-extensions: DataKinds @@ -188,7 +182,7 @@ library -- Packages bundles with GHC, mtl and text are also here build-depends: - base >=4.7 && <5 + base >=4.10 && <5 , binary >=0.7.1.0 && <0.11 , bytestring >=0.10.4.0 && <0.13 , containers >=0.5.5.1 && <0.8 @@ -196,7 +190,7 @@ library , exceptions >=0.10.2 && <0.11 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.4 , text >=1.2.0.6 && <2.2 - , time-compat >=1.9.2.2 && <1.10 + , time >=1.8.0.2 && <2 , transformers >=0.3.0.0 && <0.7 -- other packages @@ -229,9 +223,6 @@ library http-client-tls >=0.3.5.3 && <0.4 , tls >=1.4.1 - if !impl(ghc >=8.0) - build-depends: semigroups >=0.18.5 && <0.20 - test-suite github-test default-language: Haskell2010 type: exitcode-stdio-1.0 diff --git a/samples/Operational/Operational.hs b/samples/Operational/Operational.hs index cbfc9fb4..1fc7f897 100644 --- a/samples/Operational/Operational.hs +++ b/samples/Operational/Operational.hs @@ -1,7 +1,7 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE OverloadedStrings #-} + module Main (main) where import Common diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 20ebe7fd..740c6837 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | -- This module re-exports the @GitHub.Data.@ and "GitHub.Auth" submodules. diff --git a/src/GitHub/Data/Name.hs b/src/GitHub/Data/Name.hs index dbc09653..99554287 100644 --- a/src/GitHub/Data/Name.hs +++ b/src/GitHub/Data/Name.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} module GitHub.Data.Name ( Name(..), mkName, @@ -8,10 +7,8 @@ module GitHub.Data.Name ( import Prelude () import GitHub.Internal.Prelude -#if MIN_VERSION_aeson(1,0,0) import Data.Aeson.Types (FromJSONKey (..), ToJSONKey (..), fromJSONKeyCoerce, toJSONKeyText) -#endif newtype Name entity = N Text deriving (Eq, Ord, Show, Generic, Typeable, Data) @@ -38,7 +35,6 @@ instance ToJSON (Name entity) where instance IsString (Name entity) where fromString = N . fromString -#if MIN_VERSION_aeson(1,0,0) -- | @since 0.15.0.0 instance ToJSONKey (Name entity) where toJSONKey = toJSONKeyText untagName @@ -46,4 +42,3 @@ instance ToJSONKey (Name entity) where -- | @since 0.15.0.0 instance FromJSONKey (Name entity) where fromJSONKey = fromJSONKeyCoerce -#endif diff --git a/src/GitHub/Data/RateLimit.hs b/src/GitHub/Data/RateLimit.hs index 2db078af..4e0b549c 100644 --- a/src/GitHub/Data/RateLimit.hs +++ b/src/GitHub/Data/RateLimit.hs @@ -3,7 +3,7 @@ module GitHub.Data.RateLimit where import GitHub.Internal.Prelude import Prelude () -import Data.Time.Clock.System.Compat (SystemTime (..)) +import Data.Time.Clock.System (SystemTime (..)) import qualified Data.ByteString.Char8 as BS8 import qualified Network.HTTP.Client as HTTP diff --git a/src/GitHub/Data/Repos.hs b/src/GitHub/Data/Repos.hs index 98c254c2..456775b6 100644 --- a/src/GitHub/Data/Repos.hs +++ b/src/GitHub/Data/Repos.hs @@ -1,6 +1,4 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -#define UNSAFE 1 -- | -- This module also exports @@ -19,13 +17,7 @@ import Prelude () import qualified Data.HashMap.Strict as HM import qualified Data.Text as T -#if MIN_VERSION_aeson(1,0,0) import Data.Aeson.Types (FromJSONKey (..), fromJSONKeyCoerce) -#else -#ifdef UNSAFE -import Unsafe.Coerce (unsafeCoerce) -#endif -#endif data Repo = Repo { repoId :: !(Id Repo) @@ -383,22 +375,8 @@ instance FromJSON Language where instance ToJSON Language where toJSON = toJSON . getLanguage -#if MIN_VERSION_aeson(1,0,0) instance FromJSONKey Language where fromJSONKey = fromJSONKeyCoerce -#else -instance FromJSON a => FromJSON (HM.HashMap Language a) where - parseJSON = fmap mapKeyLanguage . parseJSON - where - mapKeyLanguage :: HM.HashMap Text a -> HM.HashMap Language a -#ifdef UNSAFE - mapKeyLanguage = unsafeCoerce -#else - mapKeyLanguage = mapKey Language - mapKey :: (Eq k2, Hashable k2) => (k1 -> k2) -> HM.HashMap k1 a -> HM.HashMap k2 a - mapKey f = HM.fromList . map (first f) . HM.toList -#endif -#endif data ArchiveFormat = ArchiveFormatTarball -- ^ ".tar.gz" format diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index 445c4223..7b4eac40 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} diff --git a/src/GitHub/Endpoints/Issues.hs b/src/GitHub/Endpoints/Issues.hs index 9cd7258f..47888dc5 100644 --- a/src/GitHub/Endpoints/Issues.hs +++ b/src/GitHub/Endpoints/Issues.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | -- The issues API as described on . diff --git a/src/GitHub/Endpoints/Repos/Comments.hs b/src/GitHub/Endpoints/Repos/Comments.hs index 371288e3..bd554492 100644 --- a/src/GitHub/Endpoints/Repos/Comments.hs +++ b/src/GitHub/Endpoints/Repos/Comments.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | -- The repo commits API as described on -- . diff --git a/src/GitHub/Endpoints/Repos/Commits.hs b/src/GitHub/Endpoints/Repos/Commits.hs index 3a10e0a9..1c50c651 100644 --- a/src/GitHub/Endpoints/Repos/Commits.hs +++ b/src/GitHub/Endpoints/Repos/Commits.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | -- The repo commits API as described on -- . diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index 0419d934..d6efaf39 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -1,5 +1,4 @@ {-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE CPP #-} -- | -- This module may change between minor releases. Do not rely on its contents. @@ -24,7 +23,7 @@ import Data.Maybe as X (catMaybes) import Data.Semigroup as X (Semigroup (..)) import Data.String as X (IsString (..)) import Data.Text as X (Text, pack, unpack) -import Data.Time.Compat as X (UTCTime) +import Data.Time as X (UTCTime) import Data.Time.ISO8601 as X (formatISO8601) import Data.Vector as X (Vector) import GHC.Generics as X (Generic) From a71ddecb90f091349827a6aea8a856ea5bb11bc3 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Mon, 11 Nov 2024 17:42:45 +0100 Subject: [PATCH 099/121] Bump CI to GHC 9.12.1 --- .github/workflows/haskell-ci.yml | 73 +++++++++++++++++++------------- cabal.haskell-ci | 14 +++--- github.cabal | 3 +- samples/github-samples.cabal | 7 +-- 4 files changed, 57 insertions(+), 40 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 738964dc..ea643e3f 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/andreasabel/haskell-ci # -# version: 0.19.20240703 +# version: 0.19.20241219 # -# REGENDATA ("0.19.20240703",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.19.20241219",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -32,14 +32,19 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.12.1 + compilerKind: ghc + compilerVersion: 9.12.1 + setup-method: ghcup + allow-failure: false - compiler: ghc-9.10.1 compilerKind: ghc compilerVersion: 9.10.1 setup-method: ghcup allow-failure: false - - compiler: ghc-9.8.2 + - compiler: ghc-9.8.4 compilerKind: ghc - compilerVersion: 9.8.2 + compilerVersion: 9.8.4 setup-method: ghcup allow-failure: false - compiler: ghc-9.6.6 @@ -89,15 +94,30 @@ jobs: allow-failure: false fail-fast: false steps: - - name: apt + - name: apt-get install run: | apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev + - name: Install GHCup + run: | mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" + - name: Install cabal-install (prerelease) + run: | + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml; + "$HOME/.ghcup/bin/ghcup" install cabal 3.15.0.0.2024.10.3 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.15.0.0.2024.10.3 -vnormal+nowrap" >> "$GITHUB_ENV" + - name: Install GHC (GHCup) + if: matrix.setup-method == 'ghcup' + run: | "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -108,21 +128,12 @@ jobs: echo "LANG=C.UTF-8" >> "$GITHUB_ENV" echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" - HCDIR=/opt/$HCKIND/$HCVER - HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") - HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') - HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') - echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" - echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + if [ $((HCNUMVER >= 91200)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" - echo "GHCJSARITH=0" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -149,6 +160,18 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + if $HEADHACKAGE; then + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project + fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local @@ -250,19 +275,9 @@ jobs: run: | rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - - name: prepare for constraint sets - run: | - rm -f cabal.project.local - - name: constraint set containers-0.7 - run: | - if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' all --dry-run ; fi - if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then cabal-plan topo | sort ; fi - if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' --dependencies-only -j2 all ; fi - if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' all ; fi - if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='containers >= 0.7' all ; fi - name: save cache - uses: actions/cache/save@v4 if: always() + uses: actions/cache/save@v4 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store diff --git a/cabal.haskell-ci b/cabal.haskell-ci index 6c697b60..ccddf4a2 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -12,11 +12,11 @@ jobs-selection: any -- constraints: text >= 2.0 -- allow-newer: *:text -- allow-newer not supported -constraint-set containers-0.7 - ghc: >= 9 - constraints: containers >= 0.7 - tests: True - run-tests: True +-- constraint-set containers-0.7 +-- ghc: >= 9 +-- constraints: containers >= 0.7 +-- tests: True +-- run-tests: True -raw-project - allow-newer: containers +-- raw-project +-- allow-newer: containers diff --git a/github.cabal b/github.cabal index d4d2d930..8ac29dbb 100644 --- a/github.cabal +++ b/github.cabal @@ -30,8 +30,9 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: + GHC == 9.12.1 GHC == 9.10.1 - GHC == 9.8.2 + GHC == 9.8.4 GHC == 9.6.6 GHC == 9.4.8 GHC == 9.2.8 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index ced03e5e..8ed82b07 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,8 +10,9 @@ description: Various samples of github package build-type: Simple tested-with: + GHC == 9.12.1 GHC == 9.10.1 - GHC == 9.8.2 + GHC == 9.8.4 GHC == 9.6.6 GHC == 9.4.8 GHC == 9.2.8 @@ -40,7 +41,7 @@ executable github-operational hs-source-dirs: Operational ghc-options: -Wall -threaded build-depends: - , base >=0 && <5 + , base , base-compat-batteries , github , github-samples @@ -56,7 +57,7 @@ common deps -Wall -threaded build-depends: - , base >=4.8 && <5 + , base , base-compat-batteries , base64-bytestring , github From e11917be3f6dc647afe2ca39e9ec1fea7867c49d Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Thu, 27 Mar 2025 17:49:01 +0100 Subject: [PATCH 100/121] Allow containers<1, bump CI to GHC 9.12.2 --- .github/workflows/haskell-ci.yml | 42 ++++++++++---------------------- github.cabal | 6 ++--- samples/github-samples.cabal | 4 +-- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index ea643e3f..d007d9bf 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -6,11 +6,11 @@ # # haskell-ci regenerate # -# For more information, see https://github.com/andreasabel/haskell-ci +# For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20241219 +# version: 0.19.20250327 # -# REGENDATA ("0.19.20241219",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.19.20250327",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -23,7 +23,7 @@ on: jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 60 container: @@ -32,9 +32,9 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.12.1 + - compiler: ghc-9.12.2 compilerKind: ghc - compilerVersion: 9.12.1 + compilerVersion: 9.12.2 setup-method: ghcup allow-failure: false - compiler: ghc-9.10.1 @@ -47,9 +47,9 @@ jobs: compilerVersion: 9.8.4 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.6 + - compiler: ghc-9.6.7 compilerKind: ghc - compilerVersion: 9.6.6 + compilerVersion: 9.6.7 setup-method: ghcup allow-failure: false - compiler: ghc-9.4.8 @@ -101,13 +101,12 @@ jobs: - name: Install GHCup run: | mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - - name: Install cabal-install (prerelease) + - name: Install cabal-install run: | - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml; - "$HOME/.ghcup/bin/ghcup" install cabal 3.15.0.0.2024.10.3 || (cat "$HOME"/.ghcup/logs/*.* && false) - echo "CABAL=$HOME/.ghcup/bin/cabal-3.15.0.0.2024.10.3 -vnormal+nowrap" >> "$GITHUB_ENV" + "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" - name: Install GHC (GHCup) if: matrix.setup-method == 'ghcup' run: | @@ -132,7 +131,7 @@ jobs: echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - if [ $((HCNUMVER >= 91200)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi + echo "HEADHACKAGE=false" >> "$GITHUB_ENV" echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} @@ -160,18 +159,6 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF - if $HEADHACKAGE; then - cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project - fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local diff --git a/github.cabal b/github.cabal index 8ac29dbb..044051fb 100644 --- a/github.cabal +++ b/github.cabal @@ -30,10 +30,10 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: - GHC == 9.12.1 + GHC == 9.12.2 GHC == 9.10.1 GHC == 9.8.4 - GHC == 9.6.6 + GHC == 9.6.7 GHC == 9.4.8 GHC == 9.2.8 GHC == 9.0.2 @@ -186,7 +186,7 @@ library base >=4.10 && <5 , binary >=0.7.1.0 && <0.11 , bytestring >=0.10.4.0 && <0.13 - , containers >=0.5.5.1 && <0.8 + , containers >=0.5.5.1 && <1 , deepseq >=1.3.0.2 && <1.6 , exceptions >=0.10.2 && <0.11 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.4 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 8ed82b07..cb9ca075 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,10 +10,10 @@ description: Various samples of github package build-type: Simple tested-with: - GHC == 9.12.1 + GHC == 9.12.2 GHC == 9.10.1 GHC == 9.8.4 - GHC == 9.6.6 + GHC == 9.6.7 GHC == 9.4.8 GHC == 9.2.8 GHC == 9.0.2 From 00fd2a376985da1f7769c683e0e15857a8481000 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 9 May 2025 11:13:10 +0200 Subject: [PATCH 101/121] Bump CI to GHC 9.10.2 --- .github/workflows/haskell-ci.yml | 13 +++++++------ github.cabal | 2 +- samples/github-samples.cabal | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index d007d9bf..bb4e2c16 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20250327 +# version: 0.19.20250506 # -# REGENDATA ("0.19.20250327",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.19.20250506",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -37,9 +37,9 @@ jobs: compilerVersion: 9.12.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.10.1 + - compiler: ghc-9.10.2 compilerKind: ghc - compilerVersion: 9.10.1 + compilerVersion: 9.10.2 setup-method: ghcup allow-failure: false - compiler: ghc-9.8.4 @@ -105,8 +105,8 @@ jobs: chmod a+x "$HOME/.ghcup/bin/ghcup" - name: Install cabal-install run: | - "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" + "$HOME/.ghcup/bin/ghcup" install cabal 3.14.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" - name: Install GHC (GHCup) if: matrix.setup-method == 'ghcup' run: | @@ -217,6 +217,7 @@ jobs: cat >> cabal.project < Date: Sat, 18 Jan 2025 14:40:12 +1100 Subject: [PATCH 102/121] add missing name field --- src/GitHub/Data/Actions/WorkflowJobs.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GitHub/Data/Actions/WorkflowJobs.hs b/src/GitHub/Data/Actions/WorkflowJobs.hs index 9698e3a9..05f28861 100644 --- a/src/GitHub/Data/Actions/WorkflowJobs.hs +++ b/src/GitHub/Data/Actions/WorkflowJobs.hs @@ -47,6 +47,7 @@ data Job = Job , jobConclusion :: !Text , jobStartedAt :: !UTCTime , jobCompletedAt :: !UTCTime + , jobName :: !(Name Job) , jobSteps :: !(Vector JobStep) , jobRunCheckUrl :: !URL , jobLabels :: !(Vector Text) @@ -84,6 +85,7 @@ instance FromJSON Job where <*> o .: "conclusion" <*> o .: "started_at" <*> o .: "completed_at" + <*> o .: "name" <*> o .: "steps" <*> o .: "check_run_url" <*> o .: "labels" From 3b24f4126272344ba7138013bdb2396addb0077f Mon Sep 17 00:00:00 2001 From: Magnus Therning Date: Sat, 9 Mar 2024 15:11:12 +0100 Subject: [PATCH 103/121] Make the subject URL optional This goes against the documentation at https://docs.github.com/en/rest/activity/notifications but it seems to be required in order to handle certain types of notifications. --- src/GitHub/Data/Activities.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub/Data/Activities.hs b/src/GitHub/Data/Activities.hs index e03986dc..850b7445 100644 --- a/src/GitHub/Data/Activities.hs +++ b/src/GitHub/Data/Activities.hs @@ -26,7 +26,7 @@ instance FromJSON RepoStarred where data Subject = Subject { subjectTitle :: !Text - , subjectURL :: !URL + , subjectURL :: !(Maybe URL) , subjectLatestCommentURL :: !(Maybe URL) -- https://developer.github.com/v3/activity/notifications/ doesn't indicate -- what the possible values for this field are. From 709cc3abb3d3b33f5305b4d299b5b2c1a173c8e7 Mon Sep 17 00:00:00 2001 From: maralorn Date: Tue, 24 Sep 2024 23:37:17 +0200 Subject: [PATCH 104/121] Add new Notification reasons --- src/GitHub/Data/Activities.hs | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/GitHub/Data/Activities.hs b/src/GitHub/Data/Activities.hs index 850b7445..540241c8 100644 --- a/src/GitHub/Data/Activities.hs +++ b/src/GitHub/Data/Activities.hs @@ -46,13 +46,18 @@ instance FromJSON Subject where <*> o .: "type" data NotificationReason - = AssignReason + = ApprovalRequestedReason + | AssignReason | AuthorReason | CommentReason + | CiActivityReason | InvitationReason | ManualReason + | MemberFeatureRequestedReason | MentionReason | ReviewRequestedReason + | SecurityAlertReason + | SecurityAdvisoryCreditReason | StateChangeReason | SubscribedReason | TeamMentionReason @@ -63,17 +68,22 @@ instance Binary NotificationReason instance FromJSON NotificationReason where parseJSON = withText "NotificationReason" $ \t -> case T.toLower t of - "assign" -> pure AssignReason - "author" -> pure AuthorReason - "comment" -> pure CommentReason - "invitation" -> pure InvitationReason - "manual" -> pure ManualReason - "mention" -> pure MentionReason - "review_requested" -> pure ReviewRequestedReason - "state_change" -> pure StateChangeReason - "subscribed" -> pure SubscribedReason - "team_mention" -> pure TeamMentionReason - _ -> fail $ "Unknown NotificationReason " ++ show t + "approval_requested" -> pure ApprovalRequestedReason + "assign" -> pure AssignReason + "author" -> pure AuthorReason + "comment" -> pure CommentReason + "ci_activity" -> pure CiActivityReason + "invitation" -> pure InvitationReason + "manual" -> pure ManualReason + "member_feature_requested" -> pure MemberFeatureRequestedReason + "mention" -> pure MentionReason + "review_requested" -> pure ReviewRequestedReason + "security_alert" -> pure SecurityAlertReason + "security_advisory_credit" -> pure SecurityAdvisoryCreditReason + "state_change" -> pure StateChangeReason + "subscribed" -> pure SubscribedReason + "team_mention" -> pure TeamMentionReason + _ -> fail $ "Unknown NotificationReason " ++ show t data Notification = Notification -- XXX: The notification id field type IS in fact string. Not sure why gh From 529e3578ce88fb3ec84ab531fbb6ad5788f8d6e0 Mon Sep 17 00:00:00 2001 From: Daan Rijks Date: Wed, 11 Sep 2024 13:55:17 +0200 Subject: [PATCH 105/121] Add initial subset of Reactions endpoints --- github.cabal | 2 + src/GitHub.hs | 10 ++++ src/GitHub/Data.hs | 2 + src/GitHub/Data/Reactions.hs | 78 +++++++++++++++++++++++++++++++ src/GitHub/Endpoints/Reactions.hs | 60 ++++++++++++++++++++++++ 5 files changed, 152 insertions(+) create mode 100644 src/GitHub/Data/Reactions.hs create mode 100644 src/GitHub/Endpoints/Reactions.hs diff --git a/github.cabal b/github.cabal index 55a825e8..f9e8e8db 100644 --- a/github.cabal +++ b/github.cabal @@ -117,6 +117,7 @@ library GitHub.Data.PublicSSHKeys GitHub.Data.PullRequests GitHub.Data.RateLimit + GitHub.Data.Reactions GitHub.Data.Releases GitHub.Data.Repos GitHub.Data.Request @@ -157,6 +158,7 @@ library GitHub.Endpoints.PullRequests.Comments GitHub.Endpoints.PullRequests.Reviews GitHub.Endpoints.RateLimit + GitHub.Endpoints.Reactions GitHub.Endpoints.Repos GitHub.Endpoints.Repos.Collaborators GitHub.Endpoints.Repos.Comments diff --git a/src/GitHub.hs b/src/GitHub.hs index c3a3d88f..309cb1db 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -285,6 +285,15 @@ module GitHub ( commitR, diffR, + -- ** Reactions + -- | See + issueReactionsR, + createIssueReactionR, + deleteIssueReactionR, + commentReactionsR, + createCommentReactionR, + deleteCommentReactionR, + -- ** Contents -- | See contentsForR, @@ -514,6 +523,7 @@ import GitHub.Endpoints.Organizations.Teams import GitHub.Endpoints.PullRequests import GitHub.Endpoints.PullRequests.Comments import GitHub.Endpoints.PullRequests.Reviews +import GitHub.Endpoints.Reactions import GitHub.Endpoints.RateLimit import GitHub.Endpoints.Repos import GitHub.Endpoints.Repos.Collaborators diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 740c6837..18fb770d 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -55,6 +55,7 @@ module GitHub.Data ( module GitHub.Data.PullRequests, module GitHub.Data.RateLimit, module GitHub.Data.Releases, + module GitHub.Data.Reactions, module GitHub.Data.Repos, module GitHub.Data.Request, module GitHub.Data.Reviews, @@ -97,6 +98,7 @@ import GitHub.Data.PublicSSHKeys import GitHub.Data.PullRequests import GitHub.Data.RateLimit import GitHub.Data.Releases +import GitHub.Data.Reactions import GitHub.Data.Repos import GitHub.Data.Request import GitHub.Data.Reviews diff --git a/src/GitHub/Data/Reactions.hs b/src/GitHub/Data/Reactions.hs new file mode 100644 index 00000000..f5fc3ead --- /dev/null +++ b/src/GitHub/Data/Reactions.hs @@ -0,0 +1,78 @@ +{-# LANGUAGE InstanceSigs #-} +module GitHub.Data.Reactions where + +import qualified Data.Text as T +import GitHub.Data.Id (Id) +import GitHub.Data.Definitions (SimpleUser) +import GitHub.Internal.Prelude +import Prelude () + +data Reaction = Reaction + { reactionId :: Id Reaction + , reactionUser :: !(Maybe SimpleUser) + , reactionContent :: !ReactionContent + , reactionCreatedAt :: !UTCTime + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData Reaction where rnf = genericRnf +instance Binary Reaction + +data NewReaction = NewReaction + { newReactionContent :: !ReactionContent + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData NewReaction where rnf = genericRnf +instance Binary NewReaction + +-- | +-- +data ReactionContent + = PlusOne + | MinusOne + | Laugh + | Confused + | Heart + | Hooray + | Rocket + | Eyes + deriving (Show, Data, Typeable, Eq, Ord, Enum, Bounded, Generic) + +instance NFData ReactionContent where rnf = genericRnf +instance Binary ReactionContent + +-- JSON instances + +instance FromJSON Reaction where + parseJSON = withObject "Reaction" $ \o -> + Reaction + <$> o .: "id" + <*> o .:? "user" + <*> o .: "content" + <*> o .: "created_at" + +instance ToJSON NewReaction where + toJSON (NewReaction content) = object ["content" .= content] + +instance FromJSON ReactionContent where + parseJSON = withText "ReactionContent" $ \case + "+1" -> pure PlusOne + "-1" -> pure MinusOne + "laugh" -> pure Laugh + "confused" -> pure Confused + "heart" -> pure Heart + "hooray" -> pure Hooray + "rocket" -> pure Rocket + "eyes" -> pure Eyes + t -> fail $ "Unknown ReactionContent: " <> T.unpack t + +instance ToJSON ReactionContent where + toJSON PlusOne = String "+1" + toJSON MinusOne = String "-1" + toJSON Laugh = String "laugh" + toJSON Confused = String "confused" + toJSON Heart = String "heart" + toJSON Hooray = String "hooray" + toJSON Rocket = String "rocket" + toJSON Eyes = String "eyes" diff --git a/src/GitHub/Endpoints/Reactions.hs b/src/GitHub/Endpoints/Reactions.hs new file mode 100644 index 00000000..a4ec31f7 --- /dev/null +++ b/src/GitHub/Endpoints/Reactions.hs @@ -0,0 +1,60 @@ +-- | +-- The Reactions API as described at +-- . +module GitHub.Endpoints.Reactions ( + issueReactionsR, + createIssueReactionR, + deleteIssueReactionR, + commentReactionsR, + createCommentReactionR, + deleteCommentReactionR, + module GitHub.Data, +) where + +import GitHub.Data +import GitHub.Internal.Prelude +import Prelude () + +-- | List reactions for an issue. +-- See +issueReactionsR :: Name Owner -> Name Repo -> Id Issue -> FetchCount -> Request k (Vector Reaction) +issueReactionsR owner repo iid = + pagedQuery ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions"] [] + +-- | Create reaction for an issue comment. +-- See +createIssueReactionR :: Name Owner -> Name Repo -> Id Issue -> ReactionContent -> Request 'RW Reaction +createIssueReactionR owner repo iid content = + command Post parts (encode $ NewReaction content) + where + parts = ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions"] + +-- | Delete an issue comment reaction. +-- See +deleteIssueReactionR :: Name Owner -> Name Repo -> Id Issue -> Id Reaction -> GenRequest 'MtUnit 'RW () +deleteIssueReactionR owner repo iid rid = + Command Delete parts mempty + where + parts = ["repos", toPathPart owner, toPathPart repo, "issues", toPathPart iid, "reactions", toPathPart rid] + +-- | List reactions for an issue comment. +-- See +commentReactionsR :: Name Owner -> Name Repo -> Id Comment -> FetchCount -> Request k (Vector Reaction) +commentReactionsR owner repo cid = + pagedQuery ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions"] [] + +-- | Create reaction for an issue comment. +-- See https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28#create-reaction-for-an-issue-comment +createCommentReactionR :: Name Owner -> Name Repo -> Id Comment -> ReactionContent -> Request 'RW Reaction +createCommentReactionR owner repo cid content = + command Post parts (encode $ NewReaction content) + where + parts = ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions"] + +-- | Delete an issue comment reaction. +-- See +deleteCommentReactionR :: Name Owner -> Name Repo -> Id Comment -> Id Reaction -> GenRequest 'MtUnit 'RW () +deleteCommentReactionR owner repo cid rid = + Command Delete parts mempty + where + parts = ["repos", toPathPart owner, toPathPart repo, "issues", "comments", toPathPart cid, "reactions", toPathPart rid] From 2bed394e451f77fca85942f6421b4968fcc0e0c4 Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Fri, 9 May 2025 08:13:45 -0700 Subject: [PATCH 106/121] Support pagination (#503) * Working on PerPageQuery * Add issuesForRepoPagedR + failing test * Testing, todo REVERT * About to try integrating paging into the normal executeRequest calls * API is looking better, call this v2 * Clean up some debugging stuff * More cleanup * More cleanup * Another slight refactor * Another cleanup * Improve test --- github.cabal | 1 + spec/GitHub/IssuesSpec.hs | 32 ++++++++++++++++---- src/GitHub/Data/Request.hs | 39 +++++++++++++++++++++++- src/GitHub/Request.hs | 62 ++++++++++++++++++++++++++++++-------- 4 files changed, 115 insertions(+), 19 deletions(-) diff --git a/github.cabal b/github.cabal index f9e8e8db..e97f8b41 100644 --- a/github.cabal +++ b/github.cabal @@ -264,6 +264,7 @@ test-suite github-test , file-embed , github , hspec >=2.6.1 && <2.12 + , http-client , tagged , text , unordered-containers diff --git a/spec/GitHub/IssuesSpec.hs b/spec/GitHub/IssuesSpec.hs index 2a7f5e7b..e673975f 100644 --- a/spec/GitHub/IssuesSpec.hs +++ b/spec/GitHub/IssuesSpec.hs @@ -6,12 +6,13 @@ import qualified GitHub import Prelude () import Prelude.Compat -import Data.Either.Compat (isRight) -import Data.Foldable (for_) -import Data.String (fromString) -import System.Environment (lookupEnv) -import Test.Hspec - (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy) +import Data.Either.Compat (isRight) +import Data.Foldable (for_) +import Data.String (fromString) +import Network.HTTP.Client (newManager, responseBody) +import System.Environment (lookupEnv) +import Test.Hspec (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy) + fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -38,6 +39,25 @@ spec = do cms <- GitHub.executeRequest auth $ GitHub.commentsR owner repo (GitHub.issueNumber i) 1 cms `shouldSatisfy` isRight + + describe "issuesForRepoR paged" $ do + it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do + mgr <- newManager GitHub.tlsManagerSettings + ret <- GitHub.executeRequestWithMgrAndRes mgr auth $ + GitHub.issuesForRepoR owner repo mempty (GitHub.FetchPage (GitHub.PageParams (Just 2) (Just 1))) + + case ret of + Left e -> + expectationFailure . show $ e + Right res -> do + let issues = responseBody res + length issues `shouldSatisfy` (<= 2) + + for_ issues $ \i -> do + cms <- GitHub.executeRequest auth $ + GitHub.commentsR owner repo (GitHub.issueNumber i) 1 + cms `shouldSatisfy` isRight + describe "issueR" $ do it "fetches issue #428" $ withAuth $ \auth -> do resIss <- GitHub.executeRequest auth $ diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index 7b4eac40..c8138c1a 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -14,6 +14,8 @@ module GitHub.Data.Request ( CommandMethod(..), toMethod, FetchCount(..), + PageParams(..), + PageLinks(..), MediaType (..), Paths, IsPathPart(..), @@ -29,6 +31,7 @@ import GitHub.Internal.Prelude import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Network.HTTP.Types.Method as Method +import Network.URI (URI) ------------------------------------------------------------------------------ -- Path parts @@ -74,7 +77,10 @@ toMethod Delete = Method.methodDelete -- | 'PagedQuery' returns just some results, using this data we can specify how -- many pages we want to fetch. -data FetchCount = FetchAtLeast !Word | FetchAll +data FetchCount = + FetchAtLeast !Word + | FetchAll + | FetchPage PageParams deriving (Eq, Ord, Read, Show, Generic, Typeable) @@ -96,6 +102,37 @@ instance Hashable FetchCount instance Binary FetchCount instance NFData FetchCount where rnf = genericRnf +------------------------------------------------------------------------------- +-- PageParams +------------------------------------------------------------------------------- + +-- | Params for specifying the precise page and items per page. +data PageParams = PageParams { + pageParamsPerPage :: Maybe Int + , pageParamsPage :: Maybe Int + } + deriving (Eq, Ord, Read, Show, Generic, Typeable) + +instance Hashable PageParams +instance Binary PageParams +instance NFData PageParams where rnf = genericRnf + +------------------------------------------------------------------------------- +-- PageLinks +------------------------------------------------------------------------------- + +-- | 'PagedQuery' returns just some results, using this data we can specify how +-- many pages we want to fetch. +data PageLinks = PageLinks { + pageLinksPrev :: Maybe URI + , pageLinksNext :: Maybe URI + , pageLinksLast :: Maybe URI + , pageLinksFirst :: Maybe URI + } + deriving (Eq, Ord, Show, Generic, Typeable) + +instance NFData PageLinks where rnf = genericRnf + ------------------------------------------------------------------------------- -- MediaType ------------------------------------------------------------------------------- diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index c5eb006c..332d1124 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -54,6 +54,7 @@ module GitHub.Request ( ParseResponse (..), makeHttpRequest, parseStatus, + parsePageLinks, StatusMap, getNextUrl, performPagedRequest, @@ -79,6 +80,7 @@ import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Except (ExceptT (..), runExceptT) import Data.Aeson (eitherDecode) import Data.List (find) +import Data.Maybe (fromMaybe) import Data.Tagged (Tagged (..)) import Data.Version (showVersion) @@ -87,13 +89,14 @@ import Network.HTTP.Client httpLbs, method, newManager, redirectCount, requestBody, requestHeaders, setQueryString, setRequestIgnoreStatus) import Network.HTTP.Link.Parser (parseLinkHeaderBS) -import Network.HTTP.Link.Types (LinkParam (..), href, linkParams) +import Network.HTTP.Link.Types (Link(..), LinkParam (..), href, linkParams) import Network.HTTP.Types (Method, RequestHeaders, Status (..)) import Network.URI (URI, escapeURIString, isUnescapedInURIComponent, parseURIReference, relativeTo) import qualified Data.ByteString as BS +import Data.ByteString.Builder (intDec, toLazyByteString) import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Data.Text.Encoding as TE @@ -199,11 +202,6 @@ executeRequest auth req = withOpenSSL $ do manager <- newManager tlsManagerSettings executeRequestWithMgr manager auth req -lessFetchCount :: Int -> FetchCount -> Bool -lessFetchCount _ FetchAll = True -lessFetchCount i (FetchAtLeast j) = i < fromIntegral j - - -- | Like 'executeRequest' but with provided 'Manager'. executeRequestWithMgr :: (AuthMethod am, ParseResponse mt a) @@ -235,10 +233,13 @@ executeRequestWithMgrAndRes mgr auth req = runExceptT $ do res <- httpLbs' httpReq (<$ res) <$> unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) - performHttpReq httpReq (PagedQuery _ _ l) = - unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) - where - predicate v = lessFetchCount (length v) l + performHttpReq httpReq (PagedQuery _ _ (FetchPage _)) = do + (res, _pageLinks) <- unTagged (performPerPageRequest httpLbs' httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b, PageLinks))) + return res + performHttpReq httpReq (PagedQuery _ _ FetchAll) = + unTagged (performPagedRequest httpLbs' (const True) httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) + performHttpReq httpReq (PagedQuery _ _ (FetchAtLeast j)) = + unTagged (performPagedRequest httpLbs' (\v -> length v < fromIntegral j) httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) performHttpReq httpReq (Command _ _ _) = do res <- httpLbs' httpReq @@ -456,7 +457,7 @@ makeHttpRequest auth r = case r of $ setReqHeaders . unTagged (modifyRequest :: Tagged mt (HTTP.Request -> HTTP.Request)) . maybe id setAuthRequest auth - . setQueryString qs + . setQueryString (qs <> extraQueryItems) $ req PagedQuery paths qs _ -> do req <- parseUrl' $ url paths @@ -464,7 +465,7 @@ makeHttpRequest auth r = case r of $ setReqHeaders . unTagged (modifyRequest :: Tagged mt (HTTP.Request -> HTTP.Request)) . maybe id setAuthRequest auth - . setQueryString qs + . setQueryString (qs <> extraQueryItems) $ req Command m paths body -> do req <- parseUrl' $ url paths @@ -496,6 +497,14 @@ makeHttpRequest auth r = case r of setBody :: LBS.ByteString -> HTTP.Request -> HTTP.Request setBody body req = req { requestBody = RequestBodyLBS body } + extraQueryItems :: [(BS.ByteString, Maybe BS.ByteString)] + extraQueryItems = case r of + PagedQuery _ _ (FetchPage pp) -> catMaybes [ + (\page -> ("page", Just (BS.toStrict $ toLazyByteString $ intDec page))) <$> pageParamsPage pp + , (\perPage -> ("per_page", Just (BS.toStrict $ toLazyByteString $ intDec perPage))) <$> pageParamsPerPage pp + ] + _ -> [] + -- | Query @Link@ header with @rel=next@ from the request headers. getNextUrl :: HTTP.Response a -> Maybe URI getNextUrl req = do @@ -542,6 +551,35 @@ performPagedRequest httpLbs' predicate initReq = Tagged $ do go (acc <> m) res' req' (_, _) -> return (acc <$ res) +-- | Helper for requesting a single page, as specified by 'PageParams'. +-- +-- This parses and returns the 'PageLinks' alongside the HTTP response. +performPerPageRequest + :: forall a m mt. (ParseResponse mt a, MonadCatch m, MonadError Error m) + => (HTTP.Request -> m (HTTP.Response LBS.ByteString)) -- ^ `httpLbs` analogue + -> HTTP.Request -- ^ initial request + -> Tagged mt (m (HTTP.Response a, PageLinks)) +performPerPageRequest httpLbs' initReq = Tagged $ do + res <- httpLbs' initReq + m <- unTagged (parseResponse initReq res :: Tagged mt (m a)) + return (m <$ res, parsePageLinks res) + +-- | Parse the 'PageLinks' from an HTTP response, where the information is +-- encoded in the Link header. +parsePageLinks :: HTTP.Response a -> PageLinks +parsePageLinks res = PageLinks { + pageLinksPrev = linkToUri <$> find (elem (Rel, "prev") . linkParams) links + , pageLinksNext = linkToUri <$> find (elem (Rel, "next") . linkParams) links + , pageLinksLast = linkToUri <$> find (elem (Rel, "last") . linkParams) links + , pageLinksFirst = linkToUri <$> find (elem (Rel, "first") . linkParams) links + } + where + links :: [Link URI] + links = fromMaybe [] (lookup "Link" (responseHeaders res) >>= parseLinkHeaderBS) + + linkToUri :: Link URI -> URI + linkToUri (Link uri _) = uri + ------------------------------------------------------------------------------- -- Internal ------------------------------------------------------------------------------- From 63a4e0cc3a2393789a6a4b489f344991b1b8a499 Mon Sep 17 00:00:00 2001 From: Tom Sydney Kerckhove Date: Sun, 16 Jul 2023 08:42:29 +0200 Subject: [PATCH 107/121] Allow JWT as an authentication method, fixes #489 --- src/GitHub/Auth.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GitHub/Auth.hs b/src/GitHub/Auth.hs index ccc2415a..2b41dbf4 100644 --- a/src/GitHub/Auth.hs +++ b/src/GitHub/Auth.hs @@ -1,5 +1,7 @@ module GitHub.Auth ( Auth (..), + Token, + JWTToken, AuthMethod, endpoint, setAuthRequest @@ -9,14 +11,17 @@ import GitHub.Internal.Prelude import Prelude () import qualified Data.ByteString as BS +import qualified Data.Text.Encoding as TE import qualified Network.HTTP.Client as HTTP type Token = BS.ByteString +type JWTToken = Text -- | The Github auth data type data Auth = BasicAuth BS.ByteString BS.ByteString -- ^ Username and password | OAuth Token -- ^ OAuth token + | JWT JWTToken -- ^ JWT Token | EnterpriseOAuth Text Token -- ^ Custom endpoint and OAuth token deriving (Show, Data, Typeable, Eq, Ord, Generic) @@ -40,10 +45,12 @@ instance AuthMethod () where instance AuthMethod Auth where endpoint (BasicAuth _ _) = Nothing endpoint (OAuth _) = Nothing + endpoint (JWT _) = Nothing endpoint (EnterpriseOAuth e _) = Just e setAuthRequest (BasicAuth u p) = HTTP.applyBasicAuth u p setAuthRequest (OAuth t) = setAuthHeader $ "token " <> t + setAuthRequest (JWT t) = setAuthHeader $ "Bearer " <> TE.encodeUtf8 t setAuthRequest (EnterpriseOAuth _ t) = setAuthHeader $ "token " <> t setAuthHeader :: BS.ByteString -> HTTP.Request -> HTTP.Request From dc438164bfc7b152074fdb58e1d3d18e86820777 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 9 May 2025 17:23:18 +0200 Subject: [PATCH 108/121] Revert "Support pagination (#503)" This reverts commit 2bed394e451f77fca85942f6421b4968fcc0e0c4. --- github.cabal | 1 - spec/GitHub/IssuesSpec.hs | 32 ++++---------------- src/GitHub/Data/Request.hs | 39 +----------------------- src/GitHub/Request.hs | 62 ++++++++------------------------------ 4 files changed, 19 insertions(+), 115 deletions(-) diff --git a/github.cabal b/github.cabal index e97f8b41..f9e8e8db 100644 --- a/github.cabal +++ b/github.cabal @@ -264,7 +264,6 @@ test-suite github-test , file-embed , github , hspec >=2.6.1 && <2.12 - , http-client , tagged , text , unordered-containers diff --git a/spec/GitHub/IssuesSpec.hs b/spec/GitHub/IssuesSpec.hs index e673975f..2a7f5e7b 100644 --- a/spec/GitHub/IssuesSpec.hs +++ b/spec/GitHub/IssuesSpec.hs @@ -6,13 +6,12 @@ import qualified GitHub import Prelude () import Prelude.Compat -import Data.Either.Compat (isRight) -import Data.Foldable (for_) -import Data.String (fromString) -import Network.HTTP.Client (newManager, responseBody) -import System.Environment (lookupEnv) -import Test.Hspec (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy) - +import Data.Either.Compat (isRight) +import Data.Foldable (for_) +import Data.String (fromString) +import System.Environment (lookupEnv) +import Test.Hspec + (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy) fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -39,25 +38,6 @@ spec = do cms <- GitHub.executeRequest auth $ GitHub.commentsR owner repo (GitHub.issueNumber i) 1 cms `shouldSatisfy` isRight - - describe "issuesForRepoR paged" $ do - it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do - mgr <- newManager GitHub.tlsManagerSettings - ret <- GitHub.executeRequestWithMgrAndRes mgr auth $ - GitHub.issuesForRepoR owner repo mempty (GitHub.FetchPage (GitHub.PageParams (Just 2) (Just 1))) - - case ret of - Left e -> - expectationFailure . show $ e - Right res -> do - let issues = responseBody res - length issues `shouldSatisfy` (<= 2) - - for_ issues $ \i -> do - cms <- GitHub.executeRequest auth $ - GitHub.commentsR owner repo (GitHub.issueNumber i) 1 - cms `shouldSatisfy` isRight - describe "issueR" $ do it "fetches issue #428" $ withAuth $ \auth -> do resIss <- GitHub.executeRequest auth $ diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index c8138c1a..7b4eac40 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -14,8 +14,6 @@ module GitHub.Data.Request ( CommandMethod(..), toMethod, FetchCount(..), - PageParams(..), - PageLinks(..), MediaType (..), Paths, IsPathPart(..), @@ -31,7 +29,6 @@ import GitHub.Internal.Prelude import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Network.HTTP.Types.Method as Method -import Network.URI (URI) ------------------------------------------------------------------------------ -- Path parts @@ -77,10 +74,7 @@ toMethod Delete = Method.methodDelete -- | 'PagedQuery' returns just some results, using this data we can specify how -- many pages we want to fetch. -data FetchCount = - FetchAtLeast !Word - | FetchAll - | FetchPage PageParams +data FetchCount = FetchAtLeast !Word | FetchAll deriving (Eq, Ord, Read, Show, Generic, Typeable) @@ -102,37 +96,6 @@ instance Hashable FetchCount instance Binary FetchCount instance NFData FetchCount where rnf = genericRnf -------------------------------------------------------------------------------- --- PageParams -------------------------------------------------------------------------------- - --- | Params for specifying the precise page and items per page. -data PageParams = PageParams { - pageParamsPerPage :: Maybe Int - , pageParamsPage :: Maybe Int - } - deriving (Eq, Ord, Read, Show, Generic, Typeable) - -instance Hashable PageParams -instance Binary PageParams -instance NFData PageParams where rnf = genericRnf - -------------------------------------------------------------------------------- --- PageLinks -------------------------------------------------------------------------------- - --- | 'PagedQuery' returns just some results, using this data we can specify how --- many pages we want to fetch. -data PageLinks = PageLinks { - pageLinksPrev :: Maybe URI - , pageLinksNext :: Maybe URI - , pageLinksLast :: Maybe URI - , pageLinksFirst :: Maybe URI - } - deriving (Eq, Ord, Show, Generic, Typeable) - -instance NFData PageLinks where rnf = genericRnf - ------------------------------------------------------------------------------- -- MediaType ------------------------------------------------------------------------------- diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index 332d1124..c5eb006c 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -54,7 +54,6 @@ module GitHub.Request ( ParseResponse (..), makeHttpRequest, parseStatus, - parsePageLinks, StatusMap, getNextUrl, performPagedRequest, @@ -80,7 +79,6 @@ import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Except (ExceptT (..), runExceptT) import Data.Aeson (eitherDecode) import Data.List (find) -import Data.Maybe (fromMaybe) import Data.Tagged (Tagged (..)) import Data.Version (showVersion) @@ -89,14 +87,13 @@ import Network.HTTP.Client httpLbs, method, newManager, redirectCount, requestBody, requestHeaders, setQueryString, setRequestIgnoreStatus) import Network.HTTP.Link.Parser (parseLinkHeaderBS) -import Network.HTTP.Link.Types (Link(..), LinkParam (..), href, linkParams) +import Network.HTTP.Link.Types (LinkParam (..), href, linkParams) import Network.HTTP.Types (Method, RequestHeaders, Status (..)) import Network.URI (URI, escapeURIString, isUnescapedInURIComponent, parseURIReference, relativeTo) import qualified Data.ByteString as BS -import Data.ByteString.Builder (intDec, toLazyByteString) import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Data.Text.Encoding as TE @@ -202,6 +199,11 @@ executeRequest auth req = withOpenSSL $ do manager <- newManager tlsManagerSettings executeRequestWithMgr manager auth req +lessFetchCount :: Int -> FetchCount -> Bool +lessFetchCount _ FetchAll = True +lessFetchCount i (FetchAtLeast j) = i < fromIntegral j + + -- | Like 'executeRequest' but with provided 'Manager'. executeRequestWithMgr :: (AuthMethod am, ParseResponse mt a) @@ -233,13 +235,10 @@ executeRequestWithMgrAndRes mgr auth req = runExceptT $ do res <- httpLbs' httpReq (<$ res) <$> unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) - performHttpReq httpReq (PagedQuery _ _ (FetchPage _)) = do - (res, _pageLinks) <- unTagged (performPerPageRequest httpLbs' httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b, PageLinks))) - return res - performHttpReq httpReq (PagedQuery _ _ FetchAll) = - unTagged (performPagedRequest httpLbs' (const True) httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) - performHttpReq httpReq (PagedQuery _ _ (FetchAtLeast j)) = - unTagged (performPagedRequest httpLbs' (\v -> length v < fromIntegral j) httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) + performHttpReq httpReq (PagedQuery _ _ l) = + unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) + where + predicate v = lessFetchCount (length v) l performHttpReq httpReq (Command _ _ _) = do res <- httpLbs' httpReq @@ -457,7 +456,7 @@ makeHttpRequest auth r = case r of $ setReqHeaders . unTagged (modifyRequest :: Tagged mt (HTTP.Request -> HTTP.Request)) . maybe id setAuthRequest auth - . setQueryString (qs <> extraQueryItems) + . setQueryString qs $ req PagedQuery paths qs _ -> do req <- parseUrl' $ url paths @@ -465,7 +464,7 @@ makeHttpRequest auth r = case r of $ setReqHeaders . unTagged (modifyRequest :: Tagged mt (HTTP.Request -> HTTP.Request)) . maybe id setAuthRequest auth - . setQueryString (qs <> extraQueryItems) + . setQueryString qs $ req Command m paths body -> do req <- parseUrl' $ url paths @@ -497,14 +496,6 @@ makeHttpRequest auth r = case r of setBody :: LBS.ByteString -> HTTP.Request -> HTTP.Request setBody body req = req { requestBody = RequestBodyLBS body } - extraQueryItems :: [(BS.ByteString, Maybe BS.ByteString)] - extraQueryItems = case r of - PagedQuery _ _ (FetchPage pp) -> catMaybes [ - (\page -> ("page", Just (BS.toStrict $ toLazyByteString $ intDec page))) <$> pageParamsPage pp - , (\perPage -> ("per_page", Just (BS.toStrict $ toLazyByteString $ intDec perPage))) <$> pageParamsPerPage pp - ] - _ -> [] - -- | Query @Link@ header with @rel=next@ from the request headers. getNextUrl :: HTTP.Response a -> Maybe URI getNextUrl req = do @@ -551,35 +542,6 @@ performPagedRequest httpLbs' predicate initReq = Tagged $ do go (acc <> m) res' req' (_, _) -> return (acc <$ res) --- | Helper for requesting a single page, as specified by 'PageParams'. --- --- This parses and returns the 'PageLinks' alongside the HTTP response. -performPerPageRequest - :: forall a m mt. (ParseResponse mt a, MonadCatch m, MonadError Error m) - => (HTTP.Request -> m (HTTP.Response LBS.ByteString)) -- ^ `httpLbs` analogue - -> HTTP.Request -- ^ initial request - -> Tagged mt (m (HTTP.Response a, PageLinks)) -performPerPageRequest httpLbs' initReq = Tagged $ do - res <- httpLbs' initReq - m <- unTagged (parseResponse initReq res :: Tagged mt (m a)) - return (m <$ res, parsePageLinks res) - --- | Parse the 'PageLinks' from an HTTP response, where the information is --- encoded in the Link header. -parsePageLinks :: HTTP.Response a -> PageLinks -parsePageLinks res = PageLinks { - pageLinksPrev = linkToUri <$> find (elem (Rel, "prev") . linkParams) links - , pageLinksNext = linkToUri <$> find (elem (Rel, "next") . linkParams) links - , pageLinksLast = linkToUri <$> find (elem (Rel, "last") . linkParams) links - , pageLinksFirst = linkToUri <$> find (elem (Rel, "first") . linkParams) links - } - where - links :: [Link URI] - links = fromMaybe [] (lookup "Link" (responseHeaders res) >>= parseLinkHeaderBS) - - linkToUri :: Link URI -> URI - linkToUri (Link uri _) = uri - ------------------------------------------------------------------------------- -- Internal ------------------------------------------------------------------------------- From 953b7519b588841c3ae7fd6235ad4fd72dbfdf0b Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 9 May 2025 12:07:46 +0200 Subject: [PATCH 109/121] Bump to 0.30, fix #520 --- github.cabal | 2 +- src/GitHub/Data/Options.hs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/github.cabal b/github.cabal index f9e8e8db..2c6bccf0 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: github -version: 0.29.1 +version: 0.30 synopsis: Access to the GitHub API, v3. category: Network description: diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index f1ce58da..bf03c617 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -122,6 +122,7 @@ instance Binary IssueState -- | 'GitHub.Data.Issues.Issue' state reason data IssueStateReason = StateReasonCompleted + | StateReasonDuplicate | StateReasonNotPlanned | StateReasonReopened deriving @@ -130,12 +131,14 @@ data IssueStateReason instance ToJSON IssueStateReason where toJSON = String . \case StateReasonCompleted -> "completed" + StateReasonDuplicate -> "duplicate" StateReasonNotPlanned -> "not_planned" StateReasonReopened -> "reopened" instance FromJSON IssueStateReason where parseJSON = withText "IssueStateReason" $ \t -> case T.toLower t of "completed" -> pure StateReasonCompleted + "duplicate" -> pure StateReasonDuplicate "not_planned" -> pure StateReasonNotPlanned "reopened" -> pure StateReasonReopened _ -> fail $ "Unknown IssueStateReason: " <> T.unpack t From a76cec17bdcda100bc58114fb7c5037a1034cf1a Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 9 May 2025 17:31:29 +0200 Subject: [PATCH 110/121] cabal.project: pass use-pkg-config flag to HsOpenSSL --- cabal.project | 1 + 1 file changed, 1 insertion(+) diff --git a/cabal.project b/cabal.project index ed0996f6..be4081d6 100644 --- a/cabal.project +++ b/cabal.project @@ -6,6 +6,7 @@ tests: True constraints: github +openssl constraints: github-samples +openssl +constraints: HsOpenSSL +use-pkg-config constraints: operational -buildExamples -- constraints: text >=2 From 854aa2138bba952503420e08cda8c5ab3733f81a Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 9 May 2025 17:29:28 +0200 Subject: [PATCH 111/121] Revert "Revert "Support pagination (#503)"" This reverts commit dc438164bfc7b152074fdb58e1d3d18e86820777. --- github.cabal | 1 + spec/GitHub/IssuesSpec.hs | 32 ++++++++++++++++---- src/GitHub/Data/Request.hs | 39 +++++++++++++++++++++++- src/GitHub/Request.hs | 62 ++++++++++++++++++++++++++++++-------- 4 files changed, 115 insertions(+), 19 deletions(-) diff --git a/github.cabal b/github.cabal index 2c6bccf0..517468bc 100644 --- a/github.cabal +++ b/github.cabal @@ -264,6 +264,7 @@ test-suite github-test , file-embed , github , hspec >=2.6.1 && <2.12 + , http-client , tagged , text , unordered-containers diff --git a/spec/GitHub/IssuesSpec.hs b/spec/GitHub/IssuesSpec.hs index 2a7f5e7b..e673975f 100644 --- a/spec/GitHub/IssuesSpec.hs +++ b/spec/GitHub/IssuesSpec.hs @@ -6,12 +6,13 @@ import qualified GitHub import Prelude () import Prelude.Compat -import Data.Either.Compat (isRight) -import Data.Foldable (for_) -import Data.String (fromString) -import System.Environment (lookupEnv) -import Test.Hspec - (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy) +import Data.Either.Compat (isRight) +import Data.Foldable (for_) +import Data.String (fromString) +import Network.HTTP.Client (newManager, responseBody) +import System.Environment (lookupEnv) +import Test.Hspec (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy) + fromRightS :: Show a => Either a b -> b fromRightS (Right b) = b @@ -38,6 +39,25 @@ spec = do cms <- GitHub.executeRequest auth $ GitHub.commentsR owner repo (GitHub.issueNumber i) 1 cms `shouldSatisfy` isRight + + describe "issuesForRepoR paged" $ do + it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do + mgr <- newManager GitHub.tlsManagerSettings + ret <- GitHub.executeRequestWithMgrAndRes mgr auth $ + GitHub.issuesForRepoR owner repo mempty (GitHub.FetchPage (GitHub.PageParams (Just 2) (Just 1))) + + case ret of + Left e -> + expectationFailure . show $ e + Right res -> do + let issues = responseBody res + length issues `shouldSatisfy` (<= 2) + + for_ issues $ \i -> do + cms <- GitHub.executeRequest auth $ + GitHub.commentsR owner repo (GitHub.issueNumber i) 1 + cms `shouldSatisfy` isRight + describe "issueR" $ do it "fetches issue #428" $ withAuth $ \auth -> do resIss <- GitHub.executeRequest auth $ diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index 7b4eac40..c8138c1a 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -14,6 +14,8 @@ module GitHub.Data.Request ( CommandMethod(..), toMethod, FetchCount(..), + PageParams(..), + PageLinks(..), MediaType (..), Paths, IsPathPart(..), @@ -29,6 +31,7 @@ import GitHub.Internal.Prelude import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Network.HTTP.Types.Method as Method +import Network.URI (URI) ------------------------------------------------------------------------------ -- Path parts @@ -74,7 +77,10 @@ toMethod Delete = Method.methodDelete -- | 'PagedQuery' returns just some results, using this data we can specify how -- many pages we want to fetch. -data FetchCount = FetchAtLeast !Word | FetchAll +data FetchCount = + FetchAtLeast !Word + | FetchAll + | FetchPage PageParams deriving (Eq, Ord, Read, Show, Generic, Typeable) @@ -96,6 +102,37 @@ instance Hashable FetchCount instance Binary FetchCount instance NFData FetchCount where rnf = genericRnf +------------------------------------------------------------------------------- +-- PageParams +------------------------------------------------------------------------------- + +-- | Params for specifying the precise page and items per page. +data PageParams = PageParams { + pageParamsPerPage :: Maybe Int + , pageParamsPage :: Maybe Int + } + deriving (Eq, Ord, Read, Show, Generic, Typeable) + +instance Hashable PageParams +instance Binary PageParams +instance NFData PageParams where rnf = genericRnf + +------------------------------------------------------------------------------- +-- PageLinks +------------------------------------------------------------------------------- + +-- | 'PagedQuery' returns just some results, using this data we can specify how +-- many pages we want to fetch. +data PageLinks = PageLinks { + pageLinksPrev :: Maybe URI + , pageLinksNext :: Maybe URI + , pageLinksLast :: Maybe URI + , pageLinksFirst :: Maybe URI + } + deriving (Eq, Ord, Show, Generic, Typeable) + +instance NFData PageLinks where rnf = genericRnf + ------------------------------------------------------------------------------- -- MediaType ------------------------------------------------------------------------------- diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index c5eb006c..332d1124 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -54,6 +54,7 @@ module GitHub.Request ( ParseResponse (..), makeHttpRequest, parseStatus, + parsePageLinks, StatusMap, getNextUrl, performPagedRequest, @@ -79,6 +80,7 @@ import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Except (ExceptT (..), runExceptT) import Data.Aeson (eitherDecode) import Data.List (find) +import Data.Maybe (fromMaybe) import Data.Tagged (Tagged (..)) import Data.Version (showVersion) @@ -87,13 +89,14 @@ import Network.HTTP.Client httpLbs, method, newManager, redirectCount, requestBody, requestHeaders, setQueryString, setRequestIgnoreStatus) import Network.HTTP.Link.Parser (parseLinkHeaderBS) -import Network.HTTP.Link.Types (LinkParam (..), href, linkParams) +import Network.HTTP.Link.Types (Link(..), LinkParam (..), href, linkParams) import Network.HTTP.Types (Method, RequestHeaders, Status (..)) import Network.URI (URI, escapeURIString, isUnescapedInURIComponent, parseURIReference, relativeTo) import qualified Data.ByteString as BS +import Data.ByteString.Builder (intDec, toLazyByteString) import qualified Data.ByteString.Lazy as LBS import qualified Data.Text as T import qualified Data.Text.Encoding as TE @@ -199,11 +202,6 @@ executeRequest auth req = withOpenSSL $ do manager <- newManager tlsManagerSettings executeRequestWithMgr manager auth req -lessFetchCount :: Int -> FetchCount -> Bool -lessFetchCount _ FetchAll = True -lessFetchCount i (FetchAtLeast j) = i < fromIntegral j - - -- | Like 'executeRequest' but with provided 'Manager'. executeRequestWithMgr :: (AuthMethod am, ParseResponse mt a) @@ -235,10 +233,13 @@ executeRequestWithMgrAndRes mgr auth req = runExceptT $ do res <- httpLbs' httpReq (<$ res) <$> unTagged (parseResponse httpReq res :: Tagged mt (ExceptT Error IO b)) - performHttpReq httpReq (PagedQuery _ _ l) = - unTagged (performPagedRequest httpLbs' predicate httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) - where - predicate v = lessFetchCount (length v) l + performHttpReq httpReq (PagedQuery _ _ (FetchPage _)) = do + (res, _pageLinks) <- unTagged (performPerPageRequest httpLbs' httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b, PageLinks))) + return res + performHttpReq httpReq (PagedQuery _ _ FetchAll) = + unTagged (performPagedRequest httpLbs' (const True) httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) + performHttpReq httpReq (PagedQuery _ _ (FetchAtLeast j)) = + unTagged (performPagedRequest httpLbs' (\v -> length v < fromIntegral j) httpReq :: Tagged mt (ExceptT Error IO (HTTP.Response b))) performHttpReq httpReq (Command _ _ _) = do res <- httpLbs' httpReq @@ -456,7 +457,7 @@ makeHttpRequest auth r = case r of $ setReqHeaders . unTagged (modifyRequest :: Tagged mt (HTTP.Request -> HTTP.Request)) . maybe id setAuthRequest auth - . setQueryString qs + . setQueryString (qs <> extraQueryItems) $ req PagedQuery paths qs _ -> do req <- parseUrl' $ url paths @@ -464,7 +465,7 @@ makeHttpRequest auth r = case r of $ setReqHeaders . unTagged (modifyRequest :: Tagged mt (HTTP.Request -> HTTP.Request)) . maybe id setAuthRequest auth - . setQueryString qs + . setQueryString (qs <> extraQueryItems) $ req Command m paths body -> do req <- parseUrl' $ url paths @@ -496,6 +497,14 @@ makeHttpRequest auth r = case r of setBody :: LBS.ByteString -> HTTP.Request -> HTTP.Request setBody body req = req { requestBody = RequestBodyLBS body } + extraQueryItems :: [(BS.ByteString, Maybe BS.ByteString)] + extraQueryItems = case r of + PagedQuery _ _ (FetchPage pp) -> catMaybes [ + (\page -> ("page", Just (BS.toStrict $ toLazyByteString $ intDec page))) <$> pageParamsPage pp + , (\perPage -> ("per_page", Just (BS.toStrict $ toLazyByteString $ intDec perPage))) <$> pageParamsPerPage pp + ] + _ -> [] + -- | Query @Link@ header with @rel=next@ from the request headers. getNextUrl :: HTTP.Response a -> Maybe URI getNextUrl req = do @@ -542,6 +551,35 @@ performPagedRequest httpLbs' predicate initReq = Tagged $ do go (acc <> m) res' req' (_, _) -> return (acc <$ res) +-- | Helper for requesting a single page, as specified by 'PageParams'. +-- +-- This parses and returns the 'PageLinks' alongside the HTTP response. +performPerPageRequest + :: forall a m mt. (ParseResponse mt a, MonadCatch m, MonadError Error m) + => (HTTP.Request -> m (HTTP.Response LBS.ByteString)) -- ^ `httpLbs` analogue + -> HTTP.Request -- ^ initial request + -> Tagged mt (m (HTTP.Response a, PageLinks)) +performPerPageRequest httpLbs' initReq = Tagged $ do + res <- httpLbs' initReq + m <- unTagged (parseResponse initReq res :: Tagged mt (m a)) + return (m <$ res, parsePageLinks res) + +-- | Parse the 'PageLinks' from an HTTP response, where the information is +-- encoded in the Link header. +parsePageLinks :: HTTP.Response a -> PageLinks +parsePageLinks res = PageLinks { + pageLinksPrev = linkToUri <$> find (elem (Rel, "prev") . linkParams) links + , pageLinksNext = linkToUri <$> find (elem (Rel, "next") . linkParams) links + , pageLinksLast = linkToUri <$> find (elem (Rel, "last") . linkParams) links + , pageLinksFirst = linkToUri <$> find (elem (Rel, "first") . linkParams) links + } + where + links :: [Link URI] + links = fromMaybe [] (lookup "Link" (responseHeaders res) >>= parseLinkHeaderBS) + + linkToUri :: Link URI -> URI + linkToUri (Link uri _) = uri + ------------------------------------------------------------------------------- -- Internal ------------------------------------------------------------------------------- From c54e7d65fad497c9d2e492ee9ea2c9e5650c2d71 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 9 May 2025 17:39:55 +0200 Subject: [PATCH 112/121] Fix compilation with bytestring<11 --- src/GitHub/Request.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GitHub/Request.hs b/src/GitHub/Request.hs index 332d1124..39deb0a6 100644 --- a/src/GitHub/Request.hs +++ b/src/GitHub/Request.hs @@ -500,8 +500,8 @@ makeHttpRequest auth r = case r of extraQueryItems :: [(BS.ByteString, Maybe BS.ByteString)] extraQueryItems = case r of PagedQuery _ _ (FetchPage pp) -> catMaybes [ - (\page -> ("page", Just (BS.toStrict $ toLazyByteString $ intDec page))) <$> pageParamsPage pp - , (\perPage -> ("per_page", Just (BS.toStrict $ toLazyByteString $ intDec perPage))) <$> pageParamsPerPage pp + (\page -> ("page", Just (LBS.toStrict $ toLazyByteString $ intDec page))) <$> pageParamsPage pp + , (\perPage -> ("per_page", Just (LBS.toStrict $ toLazyByteString $ intDec perPage))) <$> pageParamsPerPage pp ] _ -> [] From affa80fba86af0086cc6665675fd008cd0c06702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Fri, 9 Sep 2022 10:59:33 +0100 Subject: [PATCH 113/121] Implement organization membership endpoint --- src/GitHub.hs | 1 + src/GitHub/Data/Definitions.hs | 57 +++++++++++++++++++ src/GitHub/Endpoints/Organizations/Members.hs | 8 +++ 3 files changed, 66 insertions(+) diff --git a/src/GitHub.hs b/src/GitHub.hs index 309cb1db..5d323de8 100644 --- a/src/GitHub.hs +++ b/src/GitHub.hs @@ -173,6 +173,7 @@ module GitHub ( membersOfWithR, isMemberOfR, orgInvitationsR, + orgMembershipR, -- ** Outside Collaborators -- | See -- diff --git a/src/GitHub/Data/Definitions.hs b/src/GitHub/Data/Definitions.hs index 73962f28..456974f7 100644 --- a/src/GitHub/Data/Definitions.hs +++ b/src/GitHub/Data/Definitions.hs @@ -233,6 +233,63 @@ type QueryString = [(BS.ByteString, Maybe BS.ByteString)] -- | Count of elements type Count = Int + + +data MembershipRole + = MembershipRoleMember + | MembershipRoleAdmin + | MembershipRoleBillingManager + deriving + (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + +instance NFData MembershipRole where rnf = genericRnf +instance Binary MembershipRole + +instance FromJSON MembershipRole where + parseJSON = withText "MembershipRole" $ \t -> case T.toLower t of + "member" -> pure MembershipRoleMember + "admin" -> pure MembershipRoleAdmin + "billing_manager" -> pure MembershipRoleBillingManager + _ -> fail $ "Unknown MembershipRole: " <> T.unpack t + +data MembershipState + = MembershipPending + | MembershipActive + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData MembershipState where rnf = genericRnf +instance Binary MembershipState + +instance FromJSON MembershipState where + parseJSON = withText "MembershipState" $ \t -> case T.toLower t of + "active" -> pure MembershipActive + "pending" -> pure MembershipPending + _ -> fail $ "Unknown MembershipState: " <> T.unpack t + + +data Membership = Membership + { membershipUrl :: !URL + , membershipState :: !MembershipState + , membershipRole :: !MembershipRole + , membershipOrganizationUrl :: !URL + , membershipOrganization :: !SimpleOrganization + , membershipUser :: !SimpleUser + } + deriving (Show, Data, Typeable, Eq, Ord, Generic) + +instance NFData Membership where rnf = genericRnf +instance Binary Membership + +instance FromJSON Membership where + parseJSON = withObject "Membership" $ \o -> Membership + <$> o .: "url" + <*> o .: "state" + <*> o .: "role" + <*> o .: "organization_url" + <*> o .: "organization" + <*> o .: "user" + + ------------------------------------------------------------------------------- -- IssueNumber ------------------------------------------------------------------------------- diff --git a/src/GitHub/Endpoints/Organizations/Members.hs b/src/GitHub/Endpoints/Organizations/Members.hs index 84e52e43..8de82b77 100644 --- a/src/GitHub/Endpoints/Organizations/Members.hs +++ b/src/GitHub/Endpoints/Organizations/Members.hs @@ -7,6 +7,7 @@ module GitHub.Endpoints.Organizations.Members ( membersOfWithR, isMemberOfR, orgInvitationsR, + orgMembershipR, module GitHub.Data, ) where @@ -48,3 +49,10 @@ isMemberOfR user org = -- See orgInvitationsR :: Name Organization -> FetchCount -> Request 'RA (Vector Invitation) orgInvitationsR org = pagedQuery ["orgs", toPathPart org, "invitations"] [] + +-- | Get user membership information in an organization +-- +-- See +orgMembershipR :: Name User -> Name Organization -> Request 'RA Membership +orgMembershipR user org = + Query [ "orgs", toPathPart org, "memberships", toPathPart user ] [] \ No newline at end of file From 78e136d0936dd1430a5d2d366bf743b893d939b3 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 9 May 2025 18:10:20 +0200 Subject: [PATCH 114/121] Changelog for 0.30 --- CHANGELOG.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e090d021..45c00f5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,19 @@ -## Changes for 0.29.1 +## Changes for 0.30 +_2025-05-09, Andreas Abel, Peace edition_ + +- Organization membership endpoint (Domen Kožar, PR [#487](https://github.com/haskell-github/github/pull/487)). +- Allow JWT as an authentication method (Tom Sydney Kerckhove, PR [#497](https://github.com/haskell-github/github/pull/497)). +- Support pagination (Tom McLaughlin, PR [#503](https://github.com/haskell-github/github/pull/503)). +- Initial subset of Reactions endpoints (Dan Rijks, PR [#509](https://github.com/haskell-github/github/pull/509)). +- Fix `getNotifications` (maralorn, PR [#511](https://github.com/haskell-github/github/pull/511)). +- Add missing `name` field to `WorkflowJobs` `Job` type (Hugh Davidson, PR [#518](https://github.com/haskell-github/github/pull/518)). +- Add `StateReasonDuplicate` to `IssueStateReason` (PR [#523](https://github.com/haskell-github/github/pull/523)). - Drop support for GHC 8.0 and below. - Drop dependency `time-compat`. -Tested with GHC 8.2 - 9.10.1. +Tested with GHC 8.2 - 9.12.2. + ## Changes for 0.29 From 7076a46da978683e16f5617e666eb0e6fe3a3b21 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 27 Aug 2025 12:34:25 +0200 Subject: [PATCH 115/121] Drop obsolete dependency on deepseq-generics Functionality is available from deepseq --- github.cabal | 1 - src/GitHub/Auth.hs | 2 +- src/GitHub/Data/Actions/Workflows.hs | 2 +- src/GitHub/Data/Activities.hs | 8 +++--- src/GitHub/Data/Comments.hs | 10 +++---- src/GitHub/Data/Content.hs | 22 +++++++-------- src/GitHub/Data/Definitions.hs | 24 ++++++++--------- src/GitHub/Data/Deployments.hs | 12 ++++----- src/GitHub/Data/Email.hs | 4 +-- src/GitHub/Data/Enterprise/Organizations.hs | 6 ++--- src/GitHub/Data/Events.hs | 2 +- src/GitHub/Data/Gists.hs | 10 +++---- src/GitHub/Data/GitData.hs | 30 ++++++++++----------- src/GitHub/Data/Invitation.hs | 6 ++--- src/GitHub/Data/Issues.hs | 12 ++++----- src/GitHub/Data/Milestone.hs | 6 ++--- src/GitHub/Data/Options.hs | 16 +++++------ src/GitHub/Data/PullRequests.hs | 18 ++++++------- src/GitHub/Data/RateLimit.hs | 4 +-- src/GitHub/Data/Reactions.hs | 6 ++--- src/GitHub/Data/Releases.hs | 4 +-- src/GitHub/Data/Repos.hs | 20 +++++++------- src/GitHub/Data/Request.hs | 6 ++--- src/GitHub/Data/Reviews.hs | 12 +++------ src/GitHub/Data/Search.hs | 4 +-- src/GitHub/Data/Statuses.hs | 4 +-- src/GitHub/Data/Teams.hs | 20 +++++++------- src/GitHub/Data/URL.hs | 2 +- src/GitHub/Data/Webhooks.hs | 12 ++++----- src/GitHub/Internal/Prelude.hs | 1 - 30 files changed, 139 insertions(+), 147 deletions(-) diff --git a/github.cabal b/github.cabal index 517468bc..b9843588 100644 --- a/github.cabal +++ b/github.cabal @@ -203,7 +203,6 @@ library , base16-bytestring >=0.1.1.6 && <1.1 , binary-instances >=1 && <1.1 , cryptohash-sha1 >=0.11.100.1 && <0.12 - , deepseq-generics >=0.2.0.0 && <0.3 , hashable >=1.2.7.0 && <2 , http-client >=0.5.12 && <0.8 , http-link-header >=1.0.3.1 && <1.3 diff --git a/src/GitHub/Auth.hs b/src/GitHub/Auth.hs index 2b41dbf4..1800808f 100644 --- a/src/GitHub/Auth.hs +++ b/src/GitHub/Auth.hs @@ -25,7 +25,7 @@ data Auth | EnterpriseOAuth Text Token -- ^ Custom endpoint and OAuth token deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Auth where rnf = genericRnf +instance NFData Auth instance Binary Auth instance Hashable Auth diff --git a/src/GitHub/Data/Actions/Workflows.hs b/src/GitHub/Data/Actions/Workflows.hs index 9dd2252d..ae36ddbf 100644 --- a/src/GitHub/Data/Actions/Workflows.hs +++ b/src/GitHub/Data/Actions/Workflows.hs @@ -33,7 +33,7 @@ data CreateWorkflowDispatchEvent a = CreateWorkflowDispatchEvent } deriving (Show, Generic) -instance (NFData a) => NFData (CreateWorkflowDispatchEvent a) where rnf = genericRnf +instance (NFData a) => NFData (CreateWorkflowDispatchEvent a) instance (Binary a) => Binary (CreateWorkflowDispatchEvent a) ------------------------------------------------------------------------------- diff --git a/src/GitHub/Data/Activities.hs b/src/GitHub/Data/Activities.hs index 540241c8..70e356cf 100644 --- a/src/GitHub/Data/Activities.hs +++ b/src/GitHub/Data/Activities.hs @@ -15,7 +15,7 @@ data RepoStarred = RepoStarred } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RepoStarred where rnf = genericRnf +instance NFData RepoStarred instance Binary RepoStarred -- JSON Instances @@ -35,7 +35,7 @@ data Subject = Subject } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Subject where rnf = genericRnf +instance NFData Subject instance Binary Subject instance FromJSON Subject where @@ -63,7 +63,7 @@ data NotificationReason | TeamMentionReason deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) -instance NFData NotificationReason where rnf = genericRnf +instance NFData NotificationReason instance Binary NotificationReason instance FromJSON NotificationReason where @@ -99,7 +99,7 @@ data Notification = Notification } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Notification where rnf = genericRnf +instance NFData Notification instance Binary Notification instance FromJSON Notification where diff --git a/src/GitHub/Data/Comments.hs b/src/GitHub/Data/Comments.hs index d4a9194d..0084cd9b 100644 --- a/src/GitHub/Data/Comments.hs +++ b/src/GitHub/Data/Comments.hs @@ -21,7 +21,7 @@ data Comment = Comment } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Comment where rnf = genericRnf +instance NFData Comment instance Binary Comment instance FromJSON Comment where @@ -43,7 +43,7 @@ data NewComment = NewComment } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData NewComment where rnf = genericRnf +instance NFData NewComment instance Binary NewComment instance ToJSON NewComment where @@ -54,7 +54,7 @@ data EditComment = EditComment } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData EditComment where rnf = genericRnf +instance NFData EditComment instance Binary EditComment instance ToJSON EditComment where @@ -68,7 +68,7 @@ data NewPullComment = NewPullComment } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData NewPullComment where rnf = genericRnf +instance NFData NewPullComment instance Binary NewPullComment instance ToJSON NewPullComment where @@ -84,7 +84,7 @@ data PullCommentReply = PullCommentReply } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData PullCommentReply where rnf = genericRnf +instance NFData PullCommentReply instance ToJSON PullCommentReply where toJSON (PullCommentReply b) = diff --git a/src/GitHub/Data/Content.hs b/src/GitHub/Data/Content.hs index d776c2b6..2ac55039 100644 --- a/src/GitHub/Data/Content.hs +++ b/src/GitHub/Data/Content.hs @@ -20,7 +20,7 @@ data Content | ContentDirectory !(Vector ContentItem) deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Content where rnf = genericRnf +instance NFData Content instance Binary Content data ContentFileData = ContentFileData { @@ -30,7 +30,7 @@ data ContentFileData = ContentFileData { ,contentFileContent :: !Text } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData ContentFileData where rnf = genericRnf +instance NFData ContentFileData instance Binary ContentFileData -- | An item in a directory listing. @@ -39,13 +39,13 @@ data ContentItem = ContentItem { ,contentItemInfo :: !ContentInfo } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData ContentItem where rnf = genericRnf +instance NFData ContentItem instance Binary ContentItem data ContentItemType = ItemFile | ItemDir deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData ContentItemType where rnf = genericRnf +instance NFData ContentItemType instance Binary ContentItemType -- | Information common to both kinds of Content: files and directories. @@ -58,7 +58,7 @@ data ContentInfo = ContentInfo { ,contentHtmlUrl :: !URL } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData ContentInfo where rnf = genericRnf +instance NFData ContentInfo instance Binary ContentInfo data ContentResultInfo = ContentResultInfo @@ -66,7 +66,7 @@ data ContentResultInfo = ContentResultInfo , contentResultSize :: !Int } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData ContentResultInfo where rnf = genericRnf +instance NFData ContentResultInfo instance Binary ContentResultInfo data ContentResult = ContentResult @@ -74,7 +74,7 @@ data ContentResult = ContentResult , contentResultCommit :: !GitCommit } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData ContentResult where rnf = genericRnf +instance NFData ContentResult instance Binary ContentResult data Author = Author @@ -83,7 +83,7 @@ data Author = Author } deriving (Eq, Ord, Show, Data, Typeable, Generic) -instance NFData Author where rnf = genericRnf +instance NFData Author instance Binary Author data CreateFile = CreateFile @@ -96,7 +96,7 @@ data CreateFile = CreateFile } deriving (Eq, Ord, Show, Data, Typeable, Generic) -instance NFData CreateFile where rnf = genericRnf +instance NFData CreateFile instance Binary CreateFile data UpdateFile = UpdateFile @@ -110,7 +110,7 @@ data UpdateFile = UpdateFile } deriving (Eq, Ord, Show, Data, Typeable, Generic) -instance NFData UpdateFile where rnf = genericRnf +instance NFData UpdateFile instance Binary UpdateFile data DeleteFile = DeleteFile @@ -123,7 +123,7 @@ data DeleteFile = DeleteFile } deriving (Eq, Ord, Show, Data, Typeable, Generic) -instance NFData DeleteFile where rnf = genericRnf +instance NFData DeleteFile instance Binary DeleteFile instance FromJSON Content where diff --git a/src/GitHub/Data/Definitions.hs b/src/GitHub/Data/Definitions.hs index 456974f7..060c4bec 100644 --- a/src/GitHub/Data/Definitions.hs +++ b/src/GitHub/Data/Definitions.hs @@ -41,7 +41,7 @@ data SimpleUser = SimpleUser } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData SimpleUser where rnf = genericRnf +instance NFData SimpleUser instance Binary SimpleUser data SimpleOrganization = SimpleOrganization @@ -52,7 +52,7 @@ data SimpleOrganization = SimpleOrganization } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData SimpleOrganization where rnf = genericRnf +instance NFData SimpleOrganization instance Binary SimpleOrganization -- | Sometimes we don't know the type of the owner, e.g. in 'Repo' @@ -65,7 +65,7 @@ data SimpleOwner = SimpleOwner } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData SimpleOwner where rnf = genericRnf +instance NFData SimpleOwner instance Binary SimpleOwner data User = User @@ -90,7 +90,7 @@ data User = User } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData User where rnf = genericRnf +instance NFData User instance Binary User data Organization = Organization @@ -113,14 +113,14 @@ data Organization = Organization } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Organization where rnf = genericRnf +instance NFData Organization instance Binary Organization -- | In practice you can't have concrete values of 'Owner'. newtype Owner = Owner (Either User Organization) deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Owner where rnf = genericRnf +instance NFData Owner instance Binary Owner fromOwner :: Owner -> Either User Organization @@ -242,7 +242,7 @@ data MembershipRole deriving (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) -instance NFData MembershipRole where rnf = genericRnf +instance NFData MembershipRole instance Binary MembershipRole instance FromJSON MembershipRole where @@ -257,7 +257,7 @@ data MembershipState | MembershipActive deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData MembershipState where rnf = genericRnf +instance NFData MembershipState instance Binary MembershipState instance FromJSON MembershipState where @@ -277,7 +277,7 @@ data Membership = Membership } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Membership where rnf = genericRnf +instance NFData Membership instance Binary Membership instance FromJSON Membership where @@ -324,7 +324,7 @@ data IssueLabel = IssueLabel } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData IssueLabel where rnf = genericRnf +instance NFData IssueLabel instance Binary IssueLabel instance FromJSON IssueLabel where @@ -346,7 +346,7 @@ data NewIssueLabel = NewIssueLabel } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData NewIssueLabel where rnf = genericRnf +instance NFData NewIssueLabel instance Binary NewIssueLabel @@ -373,7 +373,7 @@ data UpdateIssueLabel = UpdateIssueLabel } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData UpdateIssueLabel where rnf = genericRnf +instance NFData UpdateIssueLabel instance Binary UpdateIssueLabel diff --git a/src/GitHub/Data/Deployments.hs b/src/GitHub/Data/Deployments.hs index e14a214e..b8ba2df0 100644 --- a/src/GitHub/Data/Deployments.hs +++ b/src/GitHub/Data/Deployments.hs @@ -36,7 +36,7 @@ data DeploymentQueryOption | DeploymentQueryEnvironment !Text deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData DeploymentQueryOption where rnf = genericRnf +instance NFData DeploymentQueryOption instance Binary DeploymentQueryOption renderDeploymentQueryOption :: DeploymentQueryOption -> (ByteString, ByteString) @@ -63,7 +63,7 @@ data Deployment a = Deployment , deploymentRepositoryUrl :: !URL } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData a => NFData (Deployment a) where rnf = genericRnf +instance NFData a => NFData (Deployment a) instance Binary a => Binary (Deployment a) instance FromJSON a => FromJSON (Deployment a) where @@ -106,7 +106,7 @@ data CreateDeployment a = CreateDeployment -- ^ Short description of the deployment. Default: "" } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData a => NFData (CreateDeployment a) where rnf = genericRnf +instance NFData a => NFData (CreateDeployment a) instance Binary a => Binary (CreateDeployment a) instance ToJSON a => ToJSON (CreateDeployment a) where @@ -134,7 +134,7 @@ data DeploymentStatus = DeploymentStatus , deploymentStatusRepositoryUrl :: !URL } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData DeploymentStatus where rnf = genericRnf +instance NFData DeploymentStatus instance Binary DeploymentStatus instance FromJSON DeploymentStatus where @@ -159,7 +159,7 @@ data DeploymentStatusState | DeploymentStatusInactive deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData DeploymentStatusState where rnf = genericRnf +instance NFData DeploymentStatusState instance Binary DeploymentStatusState instance ToJSON DeploymentStatusState where @@ -192,7 +192,7 @@ data CreateDeploymentStatus = CreateDeploymentStatus -- Default: "" } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData CreateDeploymentStatus where rnf = genericRnf +instance NFData CreateDeploymentStatus instance Binary CreateDeploymentStatus instance ToJSON CreateDeploymentStatus where diff --git a/src/GitHub/Data/Email.hs b/src/GitHub/Data/Email.hs index 9ff578b6..6e151760 100644 --- a/src/GitHub/Data/Email.hs +++ b/src/GitHub/Data/Email.hs @@ -10,7 +10,7 @@ data EmailVisibility | EmailVisibilityPublic deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) -instance NFData EmailVisibility where rnf = genericRnf +instance NFData EmailVisibility instance Binary EmailVisibility instance FromJSON EmailVisibility where @@ -26,7 +26,7 @@ data Email = Email , emailVisibility :: !(Maybe EmailVisibility) } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Email where rnf = genericRnf +instance NFData Email instance Binary Email instance FromJSON Email where diff --git a/src/GitHub/Data/Enterprise/Organizations.hs b/src/GitHub/Data/Enterprise/Organizations.hs index 9c48f386..29f179af 100644 --- a/src/GitHub/Data/Enterprise/Organizations.hs +++ b/src/GitHub/Data/Enterprise/Organizations.hs @@ -13,7 +13,7 @@ data CreateOrganization = CreateOrganization } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData CreateOrganization where rnf = genericRnf +instance NFData CreateOrganization instance Binary CreateOrganization data RenameOrganization = RenameOrganization @@ -21,7 +21,7 @@ data RenameOrganization = RenameOrganization } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RenameOrganization where rnf = genericRnf +instance NFData RenameOrganization instance Binary RenameOrganization data RenameOrganizationResponse = RenameOrganizationResponse @@ -30,7 +30,7 @@ data RenameOrganizationResponse = RenameOrganizationResponse } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RenameOrganizationResponse where rnf = genericRnf +instance NFData RenameOrganizationResponse instance Binary RenameOrganizationResponse -- JSON Instances diff --git a/src/GitHub/Data/Events.hs b/src/GitHub/Data/Events.hs index db0e881a..16b85eca 100644 --- a/src/GitHub/Data/Events.hs +++ b/src/GitHub/Data/Events.hs @@ -18,7 +18,7 @@ data Event = Event } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Event where rnf = genericRnf +instance NFData Event instance Binary Event instance FromJSON Event where diff --git a/src/GitHub/Data/Gists.hs b/src/GitHub/Data/Gists.hs index ab2e846d..7e46c686 100644 --- a/src/GitHub/Data/Gists.hs +++ b/src/GitHub/Data/Gists.hs @@ -23,7 +23,7 @@ data Gist = Gist , gistGitPullUrl :: !URL } deriving (Show, Data, Typeable, Eq, Generic) -instance NFData Gist where rnf = genericRnf +instance NFData Gist instance Binary Gist instance FromJSON Gist where @@ -51,7 +51,7 @@ data GistFile = GistFile } deriving (Show, Data, Typeable, Eq, Generic) -instance NFData GistFile where rnf = genericRnf +instance NFData GistFile instance Binary GistFile instance FromJSON GistFile where @@ -73,7 +73,7 @@ data GistComment = GistComment } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData GistComment where rnf = genericRnf +instance NFData GistComment instance Binary GistComment instance FromJSON GistComment where @@ -91,7 +91,7 @@ data NewGist = NewGist , newGistPublic :: !(Maybe Bool) } deriving (Show, Data, Typeable, Eq, Generic) -instance NFData NewGist where rnf = genericRnf +instance NFData NewGist instance Binary NewGist instance ToJSON NewGist where @@ -111,7 +111,7 @@ data NewGistFile = NewGistFile { newGistFileContent :: !Text } deriving (Show, Data, Typeable, Eq, Generic) -instance NFData NewGistFile where rnf = genericRnf +instance NFData NewGistFile instance Binary NewGistFile instance ToJSON NewGistFile where diff --git a/src/GitHub/Data/GitData.hs b/src/GitHub/Data/GitData.hs index 95b47533..d4fd8798 100644 --- a/src/GitHub/Data/GitData.hs +++ b/src/GitHub/Data/GitData.hs @@ -24,7 +24,7 @@ data Stats = Stats } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Stats where rnf = genericRnf +instance NFData Stats instance Binary Stats data Commit = Commit @@ -39,7 +39,7 @@ data Commit = Commit } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Commit where rnf = genericRnf +instance NFData Commit instance Binary Commit data Tree = Tree @@ -49,7 +49,7 @@ data Tree = Tree } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Tree where rnf = genericRnf +instance NFData Tree instance Binary Tree data GitTree = GitTree @@ -63,7 +63,7 @@ data GitTree = GitTree } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData GitTree where rnf = genericRnf +instance NFData GitTree instance Binary GitTree data GitCommit = GitCommit @@ -77,7 +77,7 @@ data GitCommit = GitCommit } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData GitCommit where rnf = genericRnf +instance NFData GitCommit instance Binary GitCommit data Blob = Blob @@ -89,7 +89,7 @@ data Blob = Blob } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Blob where rnf = genericRnf +instance NFData Blob instance Binary Blob data Tag = Tag @@ -100,7 +100,7 @@ data Tag = Tag } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Tag where rnf = genericRnf +instance NFData Tag instance Binary Tag data Branch = Branch @@ -109,7 +109,7 @@ data Branch = Branch } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Branch where rnf = genericRnf +instance NFData Branch data BranchCommit = BranchCommit { branchCommitSha :: !Text @@ -117,7 +117,7 @@ data BranchCommit = BranchCommit } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData BranchCommit where rnf = genericRnf +instance NFData BranchCommit instance Binary BranchCommit data Diff = Diff @@ -136,7 +136,7 @@ data Diff = Diff } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Diff where rnf = genericRnf +instance NFData Diff instance Binary Diff data NewGitReference = NewGitReference @@ -145,7 +145,7 @@ data NewGitReference = NewGitReference } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData NewGitReference where rnf = genericRnf +instance NFData NewGitReference instance Binary NewGitReference data GitReference = GitReference @@ -155,7 +155,7 @@ data GitReference = GitReference } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData GitReference where rnf = genericRnf +instance NFData GitReference instance Binary GitReference data GitObject = GitObject @@ -165,7 +165,7 @@ data GitObject = GitObject } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData GitObject where rnf = genericRnf +instance NFData GitObject instance Binary GitObject data GitUser = GitUser @@ -175,7 +175,7 @@ data GitUser = GitUser } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData GitUser where rnf = genericRnf +instance NFData GitUser instance Binary GitUser data File = File @@ -191,7 +191,7 @@ data File = File } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData File where rnf = genericRnf +instance NFData File instance Binary File -- JSON instances diff --git a/src/GitHub/Data/Invitation.hs b/src/GitHub/Data/Invitation.hs index 1ea656f9..3267c2a3 100644 --- a/src/GitHub/Data/Invitation.hs +++ b/src/GitHub/Data/Invitation.hs @@ -21,7 +21,7 @@ data Invitation = Invitation } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Invitation where rnf = genericRnf +instance NFData Invitation instance Binary Invitation instance FromJSON Invitation where @@ -43,7 +43,7 @@ data InvitationRole deriving (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) -instance NFData InvitationRole where rnf = genericRnf +instance NFData InvitationRole instance Binary InvitationRole instance FromJSON InvitationRole where @@ -67,7 +67,7 @@ data RepoInvitation = RepoInvitation } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RepoInvitation where rnf = genericRnf +instance NFData RepoInvitation instance Binary RepoInvitation instance FromJSON RepoInvitation where diff --git a/src/GitHub/Data/Issues.hs b/src/GitHub/Data/Issues.hs index 191b342e..99928ece 100644 --- a/src/GitHub/Data/Issues.hs +++ b/src/GitHub/Data/Issues.hs @@ -35,7 +35,7 @@ data Issue = Issue } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Issue where rnf = genericRnf +instance NFData Issue instance Binary Issue data NewIssue = NewIssue @@ -47,7 +47,7 @@ data NewIssue = NewIssue } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData NewIssue where rnf = genericRnf +instance NFData NewIssue instance Binary NewIssue data EditIssue = EditIssue @@ -60,7 +60,7 @@ data EditIssue = EditIssue } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData EditIssue where rnf = genericRnf +instance NFData EditIssue instance Binary EditIssue data IssueComment = IssueComment @@ -74,7 +74,7 @@ data IssueComment = IssueComment } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData IssueComment where rnf = genericRnf +instance NFData IssueComment instance Binary IssueComment -- | See @@ -108,7 +108,7 @@ data EventType | ConvertedNoteToIssue -- ^ The issue was created by converting a note in a project board to an issue. deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) -instance NFData EventType where rnf = genericRnf +instance NFData EventType instance Binary EventType -- | Issue event @@ -124,7 +124,7 @@ data IssueEvent = IssueEvent } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData IssueEvent where rnf = genericRnf +instance NFData IssueEvent instance Binary IssueEvent instance FromJSON IssueEvent where diff --git a/src/GitHub/Data/Milestone.hs b/src/GitHub/Data/Milestone.hs index 385678d1..aa907999 100644 --- a/src/GitHub/Data/Milestone.hs +++ b/src/GitHub/Data/Milestone.hs @@ -20,7 +20,7 @@ data Milestone = Milestone } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Milestone where rnf = genericRnf +instance NFData Milestone instance Binary Milestone instance FromJSON Milestone where @@ -44,7 +44,7 @@ data NewMilestone = NewMilestone } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData NewMilestone where rnf = genericRnf +instance NFData NewMilestone instance Binary NewMilestone @@ -67,7 +67,7 @@ data UpdateMilestone = UpdateMilestone } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData UpdateMilestone where rnf = genericRnf +instance NFData UpdateMilestone instance Binary UpdateMilestone diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index bf03c617..33899fbe 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -116,7 +116,7 @@ instance FromJSON IssueState where "closed" -> pure StateClosed _ -> fail $ "Unknown IssueState: " <> T.unpack t -instance NFData IssueState where rnf = genericRnf +instance NFData IssueState instance Binary IssueState -- | 'GitHub.Data.Issues.Issue' state reason @@ -143,7 +143,7 @@ instance FromJSON IssueStateReason where "reopened" -> pure StateReasonReopened _ -> fail $ "Unknown IssueStateReason: " <> T.unpack t -instance NFData IssueStateReason where rnf = genericRnf +instance NFData IssueStateReason instance Binary IssueStateReason -- | 'GitHub.Data.PullRequests.PullRequest' mergeable_state @@ -178,7 +178,7 @@ instance FromJSON MergeableState where "draft" -> pure StateDraft _ -> fail $ "Unknown MergeableState: " <> T.unpack t -instance NFData MergeableState where rnf = genericRnf +instance NFData MergeableState instance Binary MergeableState data SortDirection @@ -187,7 +187,7 @@ data SortDirection deriving (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) -instance NFData SortDirection where rnf = genericRnf +instance NFData SortDirection instance Binary SortDirection -- PR @@ -200,7 +200,7 @@ data SortPR deriving (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) -instance NFData SortPR where rnf = genericRnf +instance NFData SortPR instance Binary SortPR -- Issue @@ -213,7 +213,7 @@ data IssueFilter deriving (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) -instance NFData IssueFilter where rnf = genericRnf +instance NFData IssueFilter instance Binary IssueFilter data SortIssue @@ -223,7 +223,7 @@ data SortIssue deriving (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) -instance NFData SortIssue where rnf = genericRnf +instance NFData SortIssue instance Binary SortIssue data FilterBy a @@ -245,7 +245,7 @@ data SortCache deriving (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) -instance NFData SortCache where rnf = genericRnf +instance NFData SortCache instance Binary SortCache ------------------------------------------------------------------------------- diff --git a/src/GitHub/Data/PullRequests.hs b/src/GitHub/Data/PullRequests.hs index 79054b6a..660fd0a5 100644 --- a/src/GitHub/Data/PullRequests.hs +++ b/src/GitHub/Data/PullRequests.hs @@ -45,7 +45,7 @@ data SimplePullRequest = SimplePullRequest } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData SimplePullRequest where rnf = genericRnf +instance NFData SimplePullRequest instance Binary SimplePullRequest data PullRequest = PullRequest @@ -83,7 +83,7 @@ data PullRequest = PullRequest } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData PullRequest where rnf = genericRnf +instance NFData PullRequest instance Binary PullRequest data EditPullRequest = EditPullRequest @@ -96,7 +96,7 @@ data EditPullRequest = EditPullRequest } deriving (Show, Generic) -instance NFData EditPullRequest where rnf = genericRnf +instance NFData EditPullRequest instance Binary EditPullRequest data CreatePullRequest @@ -113,7 +113,7 @@ data CreatePullRequest } deriving (Show, Generic) -instance NFData CreatePullRequest where rnf = genericRnf +instance NFData CreatePullRequest instance Binary CreatePullRequest data PullRequestLinks = PullRequestLinks @@ -124,7 +124,7 @@ data PullRequestLinks = PullRequestLinks } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData PullRequestLinks where rnf = genericRnf +instance NFData PullRequestLinks instance Binary PullRequestLinks data PullRequestCommit = PullRequestCommit @@ -136,7 +136,7 @@ data PullRequestCommit = PullRequestCommit } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData PullRequestCommit where rnf = genericRnf +instance NFData PullRequestCommit instance Binary PullRequestCommit data PullRequestEvent = PullRequestEvent @@ -148,7 +148,7 @@ data PullRequestEvent = PullRequestEvent } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData PullRequestEvent where rnf = genericRnf +instance NFData PullRequestEvent instance Binary PullRequestEvent data PullRequestEventType @@ -165,7 +165,7 @@ data PullRequestEventType | PullRequestEdited deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData PullRequestEventType where rnf = genericRnf +instance NFData PullRequestEventType instance Binary PullRequestEventType data PullRequestReference = PullRequestReference @@ -175,7 +175,7 @@ data PullRequestReference = PullRequestReference } deriving (Eq, Ord, Show, Generic, Typeable, Data) -instance NFData PullRequestReference where rnf = genericRnf +instance NFData PullRequestReference instance Binary PullRequestReference diff --git a/src/GitHub/Data/RateLimit.hs b/src/GitHub/Data/RateLimit.hs index 4e0b549c..d2b98d73 100644 --- a/src/GitHub/Data/RateLimit.hs +++ b/src/GitHub/Data/RateLimit.hs @@ -15,7 +15,7 @@ data Limits = Limits } deriving (Show, {- Data, -} Typeable, Eq, Ord, Generic) -instance NFData Limits where rnf = genericRnf +instance NFData Limits instance Binary Limits instance FromJSON Limits where @@ -31,7 +31,7 @@ data RateLimit = RateLimit } deriving (Show, {- Data, -} Typeable, Eq, Ord, Generic) -instance NFData RateLimit where rnf = genericRnf +instance NFData RateLimit instance Binary RateLimit instance FromJSON RateLimit where diff --git a/src/GitHub/Data/Reactions.hs b/src/GitHub/Data/Reactions.hs index f5fc3ead..ade4ec7b 100644 --- a/src/GitHub/Data/Reactions.hs +++ b/src/GitHub/Data/Reactions.hs @@ -15,7 +15,7 @@ data Reaction = Reaction } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Reaction where rnf = genericRnf +instance NFData Reaction instance Binary Reaction data NewReaction = NewReaction @@ -23,7 +23,7 @@ data NewReaction = NewReaction } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData NewReaction where rnf = genericRnf +instance NFData NewReaction instance Binary NewReaction -- | @@ -39,7 +39,7 @@ data ReactionContent | Eyes deriving (Show, Data, Typeable, Eq, Ord, Enum, Bounded, Generic) -instance NFData ReactionContent where rnf = genericRnf +instance NFData ReactionContent instance Binary ReactionContent -- JSON instances diff --git a/src/GitHub/Data/Releases.hs b/src/GitHub/Data/Releases.hs index 582b524c..0f9c40b7 100644 --- a/src/GitHub/Data/Releases.hs +++ b/src/GitHub/Data/Releases.hs @@ -47,7 +47,7 @@ instance FromJSON Release where <*> o .: "author" <*> o .: "assets" -instance NFData Release where rnf = genericRnf +instance NFData Release instance Binary Release data ReleaseAsset = ReleaseAsset @@ -81,5 +81,5 @@ instance FromJSON ReleaseAsset where <*> o .: "updated_at" <*> o .: "uploader" -instance NFData ReleaseAsset where rnf = genericRnf +instance NFData ReleaseAsset instance Binary ReleaseAsset diff --git a/src/GitHub/Data/Repos.hs b/src/GitHub/Data/Repos.hs index 456775b6..8964c00b 100644 --- a/src/GitHub/Data/Repos.hs +++ b/src/GitHub/Data/Repos.hs @@ -55,7 +55,7 @@ data Repo = Repo } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Repo where rnf = genericRnf +instance NFData Repo instance Binary Repo data CodeSearchRepo = CodeSearchRepo @@ -90,7 +90,7 @@ data CodeSearchRepo = CodeSearchRepo } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData CodeSearchRepo where rnf = genericRnf +instance NFData CodeSearchRepo instance Binary CodeSearchRepo -- | Repository permissions, as they relate to the authenticated user. @@ -103,7 +103,7 @@ data RepoPermissions = RepoPermissions } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RepoPermissions where rnf = genericRnf +instance NFData RepoPermissions instance Binary RepoPermissions data RepoRef = RepoRef @@ -112,7 +112,7 @@ data RepoRef = RepoRef } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RepoRef where rnf = genericRnf +instance NFData RepoRef instance Binary RepoRef data NewRepo = NewRepo @@ -131,7 +131,7 @@ data NewRepo = NewRepo , newRepoAllowRebaseMerge :: !(Maybe Bool) } deriving (Eq, Ord, Show, Data, Typeable, Generic) -instance NFData NewRepo where rnf = genericRnf +instance NFData NewRepo instance Binary NewRepo newRepo :: Name Repo -> NewRepo @@ -153,7 +153,7 @@ data EditRepo = EditRepo } deriving (Eq, Ord, Show, Data, Typeable, Generic) -instance NFData EditRepo where rnf = genericRnf +instance NFData EditRepo instance Binary EditRepo -- | Filter the list of the user's repos using any of these constructors. @@ -175,7 +175,7 @@ newtype Language = Language Text getLanguage :: Language -> Text getLanguage (Language l) = l -instance NFData Language where rnf = genericRnf +instance NFData Language instance Binary Language instance Hashable Language where hashWithSalt salt (Language l) = hashWithSalt salt l @@ -190,7 +190,7 @@ data Contributor | AnonymousContributor !Int !Text deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Contributor where rnf = genericRnf +instance NFData Contributor instance Binary Contributor contributorToSimpleUser :: Contributor -> Maybe SimpleUser @@ -207,7 +207,7 @@ data CollaboratorPermission | CollaboratorPermissionNone deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) -instance NFData CollaboratorPermission where rnf = genericRnf +instance NFData CollaboratorPermission instance Binary CollaboratorPermission -- | A collaborator and its permission on a repository. @@ -216,7 +216,7 @@ data CollaboratorWithPermission = CollaboratorWithPermission SimpleUser CollaboratorPermission deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData CollaboratorWithPermission where rnf = genericRnf +instance NFData CollaboratorWithPermission instance Binary CollaboratorWithPermission -- JSON instances diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index c8138c1a..0ff3ae1b 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -100,7 +100,7 @@ instance Num FetchCount where instance Hashable FetchCount instance Binary FetchCount -instance NFData FetchCount where rnf = genericRnf +instance NFData FetchCount ------------------------------------------------------------------------------- -- PageParams @@ -115,7 +115,7 @@ data PageParams = PageParams { instance Hashable PageParams instance Binary PageParams -instance NFData PageParams where rnf = genericRnf +instance NFData PageParams ------------------------------------------------------------------------------- -- PageLinks @@ -131,7 +131,7 @@ data PageLinks = PageLinks { } deriving (Eq, Ord, Show, Generic, Typeable) -instance NFData PageLinks where rnf = genericRnf +instance NFData PageLinks ------------------------------------------------------------------------------- -- MediaType diff --git a/src/GitHub/Data/Reviews.hs b/src/GitHub/Data/Reviews.hs index b00edb74..c8761e0a 100644 --- a/src/GitHub/Data/Reviews.hs +++ b/src/GitHub/Data/Reviews.hs @@ -16,9 +16,7 @@ data ReviewState | ReviewStateChangesRequested deriving (Show, Enum, Bounded, Eq, Ord, Generic) -instance NFData ReviewState where - rnf = genericRnf - +instance NFData ReviewState instance Binary ReviewState instance FromJSON ReviewState where @@ -41,9 +39,7 @@ data Review = Review , reviewId :: !(Id Review) } deriving (Show, Generic) -instance NFData Review where - rnf = genericRnf - +instance NFData Review instance Binary Review instance FromJSON Review where @@ -74,9 +70,7 @@ data ReviewComment = ReviewComment , reviewCommentPullRequestUrl :: !URL } deriving (Show, Generic) -instance NFData ReviewComment where - rnf = genericRnf - +instance NFData ReviewComment instance Binary ReviewComment instance FromJSON ReviewComment where diff --git a/src/GitHub/Data/Search.hs b/src/GitHub/Data/Search.hs index b56067b0..fd333482 100644 --- a/src/GitHub/Data/Search.hs +++ b/src/GitHub/Data/Search.hs @@ -15,7 +15,7 @@ data SearchResult' entities = SearchResult type SearchResult entity = SearchResult' (V.Vector entity) -instance NFData entities => NFData (SearchResult' entities) where rnf = genericRnf +instance NFData entities => NFData (SearchResult' entities) instance Binary entities => Binary (SearchResult' entities) instance (Monoid entities, FromJSON entities) => FromJSON (SearchResult' entities) where @@ -40,7 +40,7 @@ data Code = Code } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Code where rnf = genericRnf +instance NFData Code instance Binary Code instance FromJSON Code where diff --git a/src/GitHub/Data/Statuses.hs b/src/GitHub/Data/Statuses.hs index 09853b26..5b488920 100644 --- a/src/GitHub/Data/Statuses.hs +++ b/src/GitHub/Data/Statuses.hs @@ -23,7 +23,7 @@ data StatusState | StatusFailure deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) -instance NFData StatusState where rnf = genericRnf +instance NFData StatusState instance Binary StatusState instance FromJSON StatusState where @@ -75,7 +75,7 @@ data NewStatus = NewStatus } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData NewStatus where rnf = genericRnf +instance NFData NewStatus instance Binary NewStatus instance ToJSON NewStatus where diff --git a/src/GitHub/Data/Teams.hs b/src/GitHub/Data/Teams.hs index 622370ae..4f3da777 100644 --- a/src/GitHub/Data/Teams.hs +++ b/src/GitHub/Data/Teams.hs @@ -20,7 +20,7 @@ data Privacy | PrivacySecret deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) -instance NFData Privacy where rnf = genericRnf +instance NFData Privacy instance Binary Privacy data Permission @@ -29,7 +29,7 @@ data Permission | PermissionAdmin deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) -instance NFData Permission where rnf = genericRnf +instance NFData Permission instance Binary Permission data AddTeamRepoPermission = AddTeamRepoPermission @@ -37,7 +37,7 @@ data AddTeamRepoPermission = AddTeamRepoPermission } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData AddTeamRepoPermission where rnf = genericRnf +instance NFData AddTeamRepoPermission instance Binary AddTeamRepoPermission data SimpleTeam = SimpleTeam @@ -53,7 +53,7 @@ data SimpleTeam = SimpleTeam } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData SimpleTeam where rnf = genericRnf +instance NFData SimpleTeam instance Binary SimpleTeam data Team = Team @@ -72,7 +72,7 @@ data Team = Team } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData Team where rnf = genericRnf +instance NFData Team instance Binary Team data CreateTeam = CreateTeam @@ -84,7 +84,7 @@ data CreateTeam = CreateTeam } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData CreateTeam where rnf = genericRnf +instance NFData CreateTeam instance Binary CreateTeam data EditTeam = EditTeam @@ -95,7 +95,7 @@ data EditTeam = EditTeam } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData EditTeam where rnf = genericRnf +instance NFData EditTeam instance Binary EditTeam data Role @@ -111,7 +111,7 @@ data ReqState | StateActive deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData ReqState where rnf = genericRnf +instance NFData ReqState instance Binary ReqState data TeamMembership = TeamMembership @@ -121,14 +121,14 @@ data TeamMembership = TeamMembership } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData TeamMembership where rnf = genericRnf +instance NFData TeamMembership instance Binary TeamMembership data CreateTeamMembership = CreateTeamMembership { createTeamMembershipRole :: !Role } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData CreateTeamMembership where rnf = genericRnf +instance NFData CreateTeamMembership instance Binary CreateTeamMembership -- JSON Instances diff --git a/src/GitHub/Data/URL.hs b/src/GitHub/Data/URL.hs index d98703ae..c3d9edcc 100644 --- a/src/GitHub/Data/URL.hs +++ b/src/GitHub/Data/URL.hs @@ -15,7 +15,7 @@ newtype URL = URL Text getUrl :: URL -> Text getUrl (URL url) = url -instance NFData URL where rnf = genericRnf +instance NFData URL instance Binary URL instance ToJSON URL where diff --git a/src/GitHub/Data/Webhooks.hs b/src/GitHub/Data/Webhooks.hs index 143d8006..32e97287 100644 --- a/src/GitHub/Data/Webhooks.hs +++ b/src/GitHub/Data/Webhooks.hs @@ -22,7 +22,7 @@ data RepoWebhook = RepoWebhook } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RepoWebhook where rnf = genericRnf +instance NFData RepoWebhook instance Binary RepoWebhook -- | See . @@ -87,7 +87,7 @@ data RepoWebhookEvent | WebhookWorkflowRun deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RepoWebhookEvent where rnf = genericRnf +instance NFData RepoWebhookEvent instance Binary RepoWebhookEvent data RepoWebhookResponse = RepoWebhookResponse @@ -97,7 +97,7 @@ data RepoWebhookResponse = RepoWebhookResponse } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData RepoWebhookResponse where rnf = genericRnf +instance NFData RepoWebhookResponse instance Binary RepoWebhookResponse data PingEvent = PingEvent @@ -107,7 +107,7 @@ data PingEvent = PingEvent } deriving (Show, Data, Typeable, Eq, Ord, Generic) -instance NFData PingEvent where rnf = genericRnf +instance NFData PingEvent instance Binary PingEvent data NewRepoWebhook = NewRepoWebhook @@ -118,7 +118,7 @@ data NewRepoWebhook = NewRepoWebhook } deriving (Eq, Ord, Show, Typeable, Data, Generic) -instance NFData NewRepoWebhook where rnf = genericRnf +instance NFData NewRepoWebhook instance Binary NewRepoWebhook data EditRepoWebhook = EditRepoWebhook @@ -130,7 +130,7 @@ data EditRepoWebhook = EditRepoWebhook } deriving (Eq, Ord, Show, Typeable, Data, Generic) -instance NFData EditRepoWebhook where rnf = genericRnf +instance NFData EditRepoWebhook instance Binary EditRepoWebhook -- JSON instances diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index d6efaf39..03a38b13 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -7,7 +7,6 @@ module GitHub.Internal.Prelude ( module X ) where import Control.Applicative as X ((<|>)) import Control.DeepSeq as X (NFData (..)) -import Control.DeepSeq.Generics as X (genericRnf) import Data.Aeson as X (FromJSON (..), Object, ToJSON (..), Value (..), encode, object, withObject, withText, (.!=), (.:), (.:?), (.=)) From 355eb4813f169eec5f12da279f6c208ff4785f7e Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 27 Aug 2025 12:43:44 +0200 Subject: [PATCH 116/121] Bump dependency lower bounds to at least Stackage LTS 10.0 (GHC 8.2.2) --- github.cabal | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/github.cabal b/github.cabal index b9843588..ba4bae57 100644 --- a/github.cabal +++ b/github.cabal @@ -184,17 +184,18 @@ library autogen-modules: Paths_github -- Packages bundles with GHC, mtl and text are also here + -- Lower bounds at least those of https://www.stackage.org/lts-10.0 (GHC 8.2.2) build-depends: base >=4.10 && <5 - , binary >=0.7.1.0 && <0.11 - , bytestring >=0.10.4.0 && <0.13 - , containers >=0.5.5.1 && <1 - , deepseq >=1.3.0.2 && <1.6 + , binary >=0.8.5.1 && <0.11 + , bytestring >=0.10.8.2 && <0.13 + , containers >=0.5.10.2 && <1 + , deepseq >=1.4.3.0 && <1.6 , exceptions >=0.10.2 && <0.11 - , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.4 - , text >=1.2.0.6 && <2.2 + , mtl >=2.2.1 && <2.4 + , text >=1.2.2.2 && <2.2 , time >=1.8.0.2 && <2 - , transformers >=0.3.0.0 && <0.7 + , transformers >=0.5.2.0 && <0.7 -- other packages build-depends: From 81009cb0f4dd5dd442ef46379d84cb7c6828a9f2 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 27 Aug 2025 12:47:05 +0200 Subject: [PATCH 117/121] Remove unused dependency transformers-compat --- github.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/github.cabal b/github.cabal index ba4bae57..54f0d2a1 100644 --- a/github.cabal +++ b/github.cabal @@ -211,7 +211,6 @@ library , iso8601-time >=0.1.5 && <0.2 , network-uri >=2.6.1.0 && <2.7 , tagged >=0.8.5 && <0.9 - , transformers-compat >=0.6.5 && <0.8 , unordered-containers >=0.2.10.0 && <0.3 , vector >=0.12.0.1 && <0.14 From 50e43d5e6790ee5f7630821709b94db47b43a0c4 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 27 Aug 2025 12:51:35 +0200 Subject: [PATCH 118/121] Remove obsolete `deriving Typeable` --- src/GitHub/Auth.hs | 2 +- src/GitHub/Data/Actions/Artifacts.hs | 4 +-- src/GitHub/Data/Actions/Cache.hs | 6 ++-- src/GitHub/Data/Actions/Common.hs | 2 +- src/GitHub/Data/Actions/Secrets.hs | 16 +++++----- src/GitHub/Data/Actions/WorkflowJobs.hs | 6 ++-- src/GitHub/Data/Actions/WorkflowRuns.hs | 6 ++-- src/GitHub/Data/Actions/Workflows.hs | 2 +- src/GitHub/Data/Activities.hs | 8 ++--- src/GitHub/Data/Comments.hs | 10 +++--- src/GitHub/Data/Content.hs | 22 ++++++------- src/GitHub/Data/Definitions.hs | 34 ++++++++++----------- src/GitHub/Data/DeployKeys.hs | 4 +-- src/GitHub/Data/Deployments.hs | 12 ++++---- src/GitHub/Data/Email.hs | 4 +-- src/GitHub/Data/Enterprise/Organizations.hs | 6 ++-- src/GitHub/Data/Events.hs | 2 +- src/GitHub/Data/Gists.hs | 10 +++--- src/GitHub/Data/GitData.hs | 32 +++++++++---------- src/GitHub/Data/Id.hs | 2 +- src/GitHub/Data/Invitation.hs | 6 ++-- src/GitHub/Data/Issues.hs | 12 ++++---- src/GitHub/Data/Milestone.hs | 6 ++-- src/GitHub/Data/Name.hs | 2 +- src/GitHub/Data/Options.hs | 30 +++++++++--------- src/GitHub/Data/PublicSSHKeys.hs | 6 ++-- src/GitHub/Data/PullRequests.hs | 16 +++++----- src/GitHub/Data/RateLimit.hs | 4 +-- src/GitHub/Data/Reactions.hs | 6 ++-- src/GitHub/Data/Releases.hs | 4 +-- src/GitHub/Data/Repos.hs | 24 +++++++-------- src/GitHub/Data/Request.hs | 13 ++++---- src/GitHub/Data/Search.hs | 4 +-- src/GitHub/Data/Statuses.hs | 12 +++----- src/GitHub/Data/Teams.hs | 27 ++++++++-------- src/GitHub/Data/URL.hs | 2 +- src/GitHub/Data/Webhooks.hs | 12 ++++---- src/GitHub/Internal/Prelude.hs | 2 +- 38 files changed, 186 insertions(+), 192 deletions(-) diff --git a/src/GitHub/Auth.hs b/src/GitHub/Auth.hs index 1800808f..cd53cd2e 100644 --- a/src/GitHub/Auth.hs +++ b/src/GitHub/Auth.hs @@ -23,7 +23,7 @@ data Auth | OAuth Token -- ^ OAuth token | JWT JWTToken -- ^ JWT Token | EnterpriseOAuth Text Token -- ^ Custom endpoint and OAuth token - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Auth instance Binary Auth diff --git a/src/GitHub/Data/Actions/Artifacts.hs b/src/GitHub/Data/Actions/Artifacts.hs index 7b572d2b..9d8ca28e 100644 --- a/src/GitHub/Data/Actions/Artifacts.hs +++ b/src/GitHub/Data/Actions/Artifacts.hs @@ -27,7 +27,7 @@ data ArtifactWorkflowRun = ArtifactWorkflowRun , artifactWorkflowRunHeadBranch :: !Text , artifactWorkflowRunHeadSha :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data Artifact = Artifact { artifactArchiveDownloadUrl :: !URL @@ -42,7 +42,7 @@ data Artifact = Artifact , artifactUrl :: !URL , artifactWorkflowRun :: !ArtifactWorkflowRun } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) ------------------------------------------------------------------------------- -- JSON instances diff --git a/src/GitHub/Data/Actions/Cache.hs b/src/GitHub/Data/Actions/Cache.hs index a4f65a60..363e0ce3 100644 --- a/src/GitHub/Data/Actions/Cache.hs +++ b/src/GitHub/Data/Actions/Cache.hs @@ -27,20 +27,20 @@ data Cache = Cache , cacheCreatedAt :: !UTCTime , cacheSizeInBytes :: !Int } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data RepositoryCacheUsage = RepositoryCacheUsage { repositoryCacheUsageFullName :: !Text , repositoryCacheUsageActiveCachesSizeInBytes :: !Int , repositoryCacheUsageActiveCachesCount :: !Int } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data OrganizationCacheUsage = OrganizationCacheUsage { organizationCacheUsageTotalActiveCachesSizeInBytes :: !Int , organizationCacheUsageTotalActiveCachesCount :: !Int } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) ------------------------------------------------------------------------------- -- JSON instances diff --git a/src/GitHub/Data/Actions/Common.hs b/src/GitHub/Data/Actions/Common.hs index ed02b6f0..76a6130a 100644 --- a/src/GitHub/Data/Actions/Common.hs +++ b/src/GitHub/Data/Actions/Common.hs @@ -20,7 +20,7 @@ data WithTotalCount a = WithTotalCount , withTotalCountTotalCount :: !Int -- ^ The total size of the answer. } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) -- | Joining two pages of a paginated response. -- The 'withTotalCountTotalCount' is assumed to be the same in both pages, diff --git a/src/GitHub/Data/Actions/Secrets.hs b/src/GitHub/Data/Actions/Secrets.hs index c734ad89..1e2ce31b 100644 --- a/src/GitHub/Data/Actions/Secrets.hs +++ b/src/GitHub/Data/Actions/Secrets.hs @@ -33,13 +33,13 @@ data OrganizationSecret = OrganizationSecret , organizationSecretUpdatedAt :: !UTCTime , organizationSecretVisibility :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data PublicKey = PublicKey { publicKeyId :: !Text , publicKeyKey :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data SetSecret = SetSecret { setSecretPublicKeyId :: !Text @@ -47,35 +47,35 @@ data SetSecret = SetSecret , setSecretVisibility :: !Text , setSecretSelectedRepositoryIds :: !(Maybe [Id Repo]) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data SetRepoSecret = SetRepoSecret { setRepoSecretPublicKeyId :: !Text , setRepoSecretEncryptedValue :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data SelectedRepo = SelectedRepo { selectedRepoRepoId :: !(Id Repo) , selectedRepoRepoName :: !(Name Repo) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data SetSelectedRepositories = SetSelectedRepositories { setSelectedRepositoriesRepositoryIds :: ![Id Repo] } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data RepoSecret = RepoSecret { repoSecretName :: !(Name RepoSecret) , repoSecretCreatedAt :: !UTCTime , repoSecretUpdatedAt :: !UTCTime } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) -- TODO move somewhere else? data Environment = Environment - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) ------------------------------------------------------------------------------- -- JSON instances diff --git a/src/GitHub/Data/Actions/WorkflowJobs.hs b/src/GitHub/Data/Actions/WorkflowJobs.hs index 05f28861..47f11f20 100644 --- a/src/GitHub/Data/Actions/WorkflowJobs.hs +++ b/src/GitHub/Data/Actions/WorkflowJobs.hs @@ -10,7 +10,7 @@ module GitHub.Data.Actions.WorkflowJobs ( import Prelude () import GitHub.Internal.Prelude (Applicative ((<*>)), Data, Eq, FromJSON (parseJSON), Generic, Integer, - Ord, Show, Text, Typeable, UTCTime, Vector, withObject, ($), (.:), + Ord, Show, Text, UTCTime, Vector, withObject, ($), (.:), (<$>)) import GitHub.Data.Id (Id) @@ -32,7 +32,7 @@ data JobStep = JobStep , jobStepStartedAt :: !UTCTime , jobStepCompletedAt :: !UTCTime } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data Job = Job { jobId :: !(Id Job) @@ -56,7 +56,7 @@ data Job = Job , jobRunnerGroupId :: !Integer , jobRunnerGroupName :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) ------------------------------------------------------------------------------- -- JSON instances diff --git a/src/GitHub/Data/Actions/WorkflowRuns.hs b/src/GitHub/Data/Actions/WorkflowRuns.hs index 3dae581b..07657e84 100644 --- a/src/GitHub/Data/Actions/WorkflowRuns.hs +++ b/src/GitHub/Data/Actions/WorkflowRuns.hs @@ -41,10 +41,10 @@ data WorkflowRun = WorkflowRun , workflowRunAttempt :: !Integer , workflowRunStartedAt :: !UTCTime } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data RunAttempt = RunAttempt - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data ReviewHistory = ReviewHistory { reviewHistoryState :: !Text @@ -52,7 +52,7 @@ data ReviewHistory = ReviewHistory , reviewHistoryUser :: !SimpleUser } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) ------------------------------------------------------------------------------- -- JSON instances diff --git a/src/GitHub/Data/Actions/Workflows.hs b/src/GitHub/Data/Actions/Workflows.hs index ae36ddbf..a75fa0ff 100644 --- a/src/GitHub/Data/Actions/Workflows.hs +++ b/src/GitHub/Data/Actions/Workflows.hs @@ -25,7 +25,7 @@ data Workflow = Workflow , workflowHtmlUrl :: !URL , workflowBadgeUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) data CreateWorkflowDispatchEvent a = CreateWorkflowDispatchEvent { createWorkflowDispatchEventRef :: !Text diff --git a/src/GitHub/Data/Activities.hs b/src/GitHub/Data/Activities.hs index 70e356cf..b480ef21 100644 --- a/src/GitHub/Data/Activities.hs +++ b/src/GitHub/Data/Activities.hs @@ -13,7 +13,7 @@ data RepoStarred = RepoStarred { repoStarredStarredAt :: !UTCTime , repoStarredRepo :: !Repo } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RepoStarred instance Binary RepoStarred @@ -33,7 +33,7 @@ data Subject = Subject -- TODO: Make an ADT for this. , subjectType :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Subject instance Binary Subject @@ -61,7 +61,7 @@ data NotificationReason | StateChangeReason | SubscribedReason | TeamMentionReason - deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) instance NFData NotificationReason instance Binary NotificationReason @@ -97,7 +97,7 @@ data Notification = Notification , notificationLastReadAt :: !(Maybe UTCTime) , notificationUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Notification instance Binary Notification diff --git a/src/GitHub/Data/Comments.hs b/src/GitHub/Data/Comments.hs index 0084cd9b..c5987c77 100644 --- a/src/GitHub/Data/Comments.hs +++ b/src/GitHub/Data/Comments.hs @@ -19,7 +19,7 @@ data Comment = Comment , commentUser :: !SimpleUser , commentId :: !(Id Comment) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Comment instance Binary Comment @@ -41,7 +41,7 @@ instance FromJSON Comment where data NewComment = NewComment { newCommentBody :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData NewComment instance Binary NewComment @@ -52,7 +52,7 @@ instance ToJSON NewComment where data EditComment = EditComment { editCommentBody :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData EditComment instance Binary EditComment @@ -66,7 +66,7 @@ data NewPullComment = NewPullComment , newPullCommentPosition :: !Int , newPullCommentBody :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData NewPullComment instance Binary NewPullComment @@ -82,7 +82,7 @@ instance ToJSON NewPullComment where data PullCommentReply = PullCommentReply { pullCommentReplyBody :: Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData PullCommentReply diff --git a/src/GitHub/Data/Content.hs b/src/GitHub/Data/Content.hs index 2ac55039..5e0c4b92 100644 --- a/src/GitHub/Data/Content.hs +++ b/src/GitHub/Data/Content.hs @@ -18,7 +18,7 @@ import Data.Aeson (Key) data Content = ContentFile !ContentFileData | ContentDirectory !(Vector ContentItem) - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Content instance Binary Content @@ -28,7 +28,7 @@ data ContentFileData = ContentFileData { ,contentFileEncoding :: !Text ,contentFileSize :: !Int ,contentFileContent :: !Text -} deriving (Show, Data, Typeable, Eq, Ord, Generic) +} deriving (Show, Data, Eq, Ord, Generic) instance NFData ContentFileData instance Binary ContentFileData @@ -37,13 +37,13 @@ instance Binary ContentFileData data ContentItem = ContentItem { contentItemType :: !ContentItemType ,contentItemInfo :: !ContentInfo -} deriving (Show, Data, Typeable, Eq, Ord, Generic) +} deriving (Show, Data, Eq, Ord, Generic) instance NFData ContentItem instance Binary ContentItem data ContentItemType = ItemFile | ItemDir - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData ContentItemType instance Binary ContentItemType @@ -56,7 +56,7 @@ data ContentInfo = ContentInfo { ,contentUrl :: !URL ,contentGitUrl :: !URL ,contentHtmlUrl :: !URL -} deriving (Show, Data, Typeable, Eq, Ord, Generic) +} deriving (Show, Data, Eq, Ord, Generic) instance NFData ContentInfo instance Binary ContentInfo @@ -64,7 +64,7 @@ instance Binary ContentInfo data ContentResultInfo = ContentResultInfo { contentResultInfo :: !ContentInfo , contentResultSize :: !Int - } deriving (Show, Data, Typeable, Eq, Ord, Generic) + } deriving (Show, Data, Eq, Ord, Generic) instance NFData ContentResultInfo instance Binary ContentResultInfo @@ -72,7 +72,7 @@ instance Binary ContentResultInfo data ContentResult = ContentResult { contentResultContent :: !ContentResultInfo , contentResultCommit :: !GitCommit - } deriving (Show, Data, Typeable, Eq, Ord, Generic) + } deriving (Show, Data, Eq, Ord, Generic) instance NFData ContentResult instance Binary ContentResult @@ -81,7 +81,7 @@ data Author = Author { authorName :: !Text , authorEmail :: !Text } - deriving (Eq, Ord, Show, Data, Typeable, Generic) + deriving (Eq, Ord, Show, Data, Generic) instance NFData Author instance Binary Author @@ -94,7 +94,7 @@ data CreateFile = CreateFile , createFileAuthor :: !(Maybe Author) , createFileCommitter :: !(Maybe Author) } - deriving (Eq, Ord, Show, Data, Typeable, Generic) + deriving (Eq, Ord, Show, Data, Generic) instance NFData CreateFile instance Binary CreateFile @@ -108,7 +108,7 @@ data UpdateFile = UpdateFile , updateFileAuthor :: !(Maybe Author) , updateFileCommitter :: !(Maybe Author) } - deriving (Eq, Ord, Show, Data, Typeable, Generic) + deriving (Eq, Ord, Show, Data, Generic) instance NFData UpdateFile instance Binary UpdateFile @@ -121,7 +121,7 @@ data DeleteFile = DeleteFile , deleteFileAuthor :: !(Maybe Author) , deleteFileCommitter :: !(Maybe Author) } - deriving (Eq, Ord, Show, Data, Typeable, Generic) + deriving (Eq, Ord, Show, Data, Generic) instance NFData DeleteFile instance Binary DeleteFile diff --git a/src/GitHub/Data/Definitions.hs b/src/GitHub/Data/Definitions.hs index 060c4bec..12f392df 100644 --- a/src/GitHub/Data/Definitions.hs +++ b/src/GitHub/Data/Definitions.hs @@ -22,13 +22,13 @@ data Error | ParseError !Text -- ^ An error in the parser itself. | JsonError !Text -- ^ The JSON is malformed or unexpected. | UserError !Text -- ^ Incorrect input. - deriving (Show, Typeable) + deriving (Show) instance E.Exception Error -- | Type of the repository owners. data OwnerType = OwnerUser | OwnerOrganization | OwnerBot - deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Typeable, Data) + deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic, Data) instance NFData OwnerType instance Binary OwnerType @@ -39,7 +39,7 @@ data SimpleUser = SimpleUser , simpleUserAvatarUrl :: !URL , simpleUserUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData SimpleUser instance Binary SimpleUser @@ -50,7 +50,7 @@ data SimpleOrganization = SimpleOrganization , simpleOrganizationUrl :: !URL , simpleOrganizationAvatarUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData SimpleOrganization instance Binary SimpleOrganization @@ -63,7 +63,7 @@ data SimpleOwner = SimpleOwner , simpleOwnerAvatarUrl :: !URL , simpleOwnerType :: !OwnerType } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData SimpleOwner instance Binary SimpleOwner @@ -88,7 +88,7 @@ data User = User , userUrl :: !URL , userHtmlUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData User instance Binary User @@ -111,14 +111,14 @@ data Organization = Organization , organizationUrl :: !URL , organizationCreatedAt :: !UTCTime } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Organization instance Binary Organization -- | In practice you can't have concrete values of 'Owner'. newtype Owner = Owner (Either User Organization) - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Owner instance Binary Owner @@ -218,14 +218,14 @@ instance FromJSON Owner where data OrgMemberFilter = OrgMemberFilter2faDisabled -- ^ Members without two-factor authentication enabled. Available for organization owners. | OrgMemberFilterAll -- ^ All members the authenticated user can see. - deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic) + deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) -- | Filter members returned by their role. data OrgMemberRole = OrgMemberRoleAll -- ^ All members of the organization, regardless of role. | OrgMemberRoleAdmin -- ^ Organization owners. | OrgMemberRoleMember -- ^ Non-owner organization members. - deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic) + deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) -- | Request query string type QueryString = [(BS.ByteString, Maybe BS.ByteString)] @@ -240,7 +240,7 @@ data MembershipRole | MembershipRoleAdmin | MembershipRoleBillingManager deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance NFData MembershipRole instance Binary MembershipRole @@ -255,7 +255,7 @@ instance FromJSON MembershipRole where data MembershipState = MembershipPending | MembershipActive - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData MembershipState instance Binary MembershipState @@ -275,7 +275,7 @@ data Membership = Membership , membershipOrganization :: !SimpleOrganization , membershipUser :: !SimpleUser } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Membership instance Binary Membership @@ -295,7 +295,7 @@ instance FromJSON Membership where ------------------------------------------------------------------------------- newtype IssueNumber = IssueNumber Int - deriving (Eq, Ord, Show, Generic, Typeable, Data) + deriving (Eq, Ord, Show, Generic, Data) unIssueNumber :: IssueNumber -> Int unIssueNumber (IssueNumber i) = i @@ -322,7 +322,7 @@ data IssueLabel = IssueLabel , labelName :: !(Name IssueLabel) , labelDesc :: !(Maybe Text) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData IssueLabel instance Binary IssueLabel @@ -344,7 +344,7 @@ data NewIssueLabel = NewIssueLabel , newLabelName :: !(Name NewIssueLabel) , newLabelDesc :: !(Maybe Text) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData NewIssueLabel instance Binary NewIssueLabel @@ -371,7 +371,7 @@ data UpdateIssueLabel = UpdateIssueLabel , updateLabelName :: !(Name UpdateIssueLabel) , updateLabelDesc :: !(Maybe Text) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData UpdateIssueLabel instance Binary UpdateIssueLabel diff --git a/src/GitHub/Data/DeployKeys.hs b/src/GitHub/Data/DeployKeys.hs index 7dd1bb1d..af43c6cf 100644 --- a/src/GitHub/Data/DeployKeys.hs +++ b/src/GitHub/Data/DeployKeys.hs @@ -19,7 +19,7 @@ data RepoDeployKey = RepoDeployKey , repoDeployKeyCreatedAt :: !UTCTime , repoDeployKeyReadOnly :: !Bool } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance FromJSON RepoDeployKey where parseJSON = withObject "RepoDeployKey" $ \o -> RepoDeployKey @@ -36,7 +36,7 @@ data NewRepoDeployKey = NewRepoDeployKey , newRepoDeployKeyTitle :: !Text , newRepoDeployKeyReadOnly :: !Bool } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance ToJSON NewRepoDeployKey where toJSON (NewRepoDeployKey key title readOnly) = object diff --git a/src/GitHub/Data/Deployments.hs b/src/GitHub/Data/Deployments.hs index b8ba2df0..043e74be 100644 --- a/src/GitHub/Data/Deployments.hs +++ b/src/GitHub/Data/Deployments.hs @@ -34,7 +34,7 @@ data DeploymentQueryOption | DeploymentQueryRef !Text | DeploymentQueryTask !Text | DeploymentQueryEnvironment !Text - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData DeploymentQueryOption instance Binary DeploymentQueryOption @@ -61,7 +61,7 @@ data Deployment a = Deployment , deploymentUpdatedAt :: !UTCTime , deploymentStatusesUrl :: !URL , deploymentRepositoryUrl :: !URL - } deriving (Show, Data, Typeable, Eq, Ord, Generic) + } deriving (Show, Data, Eq, Ord, Generic) instance NFData a => NFData (Deployment a) instance Binary a => Binary (Deployment a) @@ -104,7 +104,7 @@ data CreateDeployment a = CreateDeployment -- qa). Default: production , createDeploymentDescription :: !(Maybe Text) -- ^ Short description of the deployment. Default: "" - } deriving (Show, Data, Typeable, Eq, Ord, Generic) + } deriving (Show, Data, Eq, Ord, Generic) instance NFData a => NFData (CreateDeployment a) instance Binary a => Binary (CreateDeployment a) @@ -132,7 +132,7 @@ data DeploymentStatus = DeploymentStatus , deploymentStatusUpdatedAt :: !UTCTime , deploymentStatusDeploymentUrl :: !URL , deploymentStatusRepositoryUrl :: !URL - } deriving (Show, Data, Typeable, Eq, Ord, Generic) + } deriving (Show, Data, Eq, Ord, Generic) instance NFData DeploymentStatus instance Binary DeploymentStatus @@ -157,7 +157,7 @@ data DeploymentStatusState | DeploymentStatusPending | DeploymentStatusSuccess | DeploymentStatusInactive - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData DeploymentStatusState instance Binary DeploymentStatusState @@ -190,7 +190,7 @@ data CreateDeploymentStatus = CreateDeploymentStatus , createDeploymentStatusDescription :: !(Maybe Text) -- ^ A short description of the status. Maximum length of 140 characters. -- Default: "" - } deriving (Show, Data, Typeable, Eq, Ord, Generic) + } deriving (Show, Data, Eq, Ord, Generic) instance NFData CreateDeploymentStatus instance Binary CreateDeploymentStatus diff --git a/src/GitHub/Data/Email.hs b/src/GitHub/Data/Email.hs index 6e151760..76efafa0 100644 --- a/src/GitHub/Data/Email.hs +++ b/src/GitHub/Data/Email.hs @@ -8,7 +8,7 @@ import qualified Data.Text as T data EmailVisibility = EmailVisibilityPrivate | EmailVisibilityPublic - deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) instance NFData EmailVisibility instance Binary EmailVisibility @@ -24,7 +24,7 @@ data Email = Email , emailVerified :: !Bool , emailPrimary :: !Bool , emailVisibility :: !(Maybe EmailVisibility) - } deriving (Show, Data, Typeable, Eq, Ord, Generic) + } deriving (Show, Data, Eq, Ord, Generic) instance NFData Email instance Binary Email diff --git a/src/GitHub/Data/Enterprise/Organizations.hs b/src/GitHub/Data/Enterprise/Organizations.hs index 29f179af..02c99453 100644 --- a/src/GitHub/Data/Enterprise/Organizations.hs +++ b/src/GitHub/Data/Enterprise/Organizations.hs @@ -11,7 +11,7 @@ data CreateOrganization = CreateOrganization , createOrganizationAdmin :: !(Name User) , createOrganizationProfileName :: !(Maybe Text) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData CreateOrganization instance Binary CreateOrganization @@ -19,7 +19,7 @@ instance Binary CreateOrganization data RenameOrganization = RenameOrganization { renameOrganizationLogin :: !(Name Organization) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RenameOrganization instance Binary RenameOrganization @@ -28,7 +28,7 @@ data RenameOrganizationResponse = RenameOrganizationResponse { renameOrganizationResponseMessage :: !Text , renameOrganizationResponseUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RenameOrganizationResponse instance Binary RenameOrganizationResponse diff --git a/src/GitHub/Data/Events.hs b/src/GitHub/Data/Events.hs index 16b85eca..4025aae7 100644 --- a/src/GitHub/Data/Events.hs +++ b/src/GitHub/Data/Events.hs @@ -16,7 +16,7 @@ data Event = Event , eventCreatedAt :: !UTCTime , eventPublic :: !Bool } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Event instance Binary Event diff --git a/src/GitHub/Data/Gists.hs b/src/GitHub/Data/Gists.hs index 7e46c686..983b7a1d 100644 --- a/src/GitHub/Data/Gists.hs +++ b/src/GitHub/Data/Gists.hs @@ -21,7 +21,7 @@ data Gist = Gist , gistId :: !(Name Gist) , gistFiles :: !(HashMap Text GistFile) , gistGitPullUrl :: !URL - } deriving (Show, Data, Typeable, Eq, Generic) + } deriving (Show, Data, Eq, Generic) instance NFData Gist instance Binary Gist @@ -49,7 +49,7 @@ data GistFile = GistFile , gistFileFilename :: !Text , gistFileContent :: !(Maybe Text) } - deriving (Show, Data, Typeable, Eq, Generic) + deriving (Show, Data, Eq, Generic) instance NFData GistFile instance Binary GistFile @@ -71,7 +71,7 @@ data GistComment = GistComment , gistCommentUpdatedAt :: !UTCTime , gistCommentId :: !(Id GistComment) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData GistComment instance Binary GistComment @@ -89,7 +89,7 @@ data NewGist = NewGist { newGistDescription :: !(Maybe Text) , newGistFiles :: !(HashMap Text NewGistFile) , newGistPublic :: !(Maybe Bool) - } deriving (Show, Data, Typeable, Eq, Generic) + } deriving (Show, Data, Eq, Generic) instance NFData NewGist instance Binary NewGist @@ -109,7 +109,7 @@ instance ToJSON NewGist where data NewGistFile = NewGistFile { newGistFileContent :: !Text - } deriving (Show, Data, Typeable, Eq, Generic) + } deriving (Show, Data, Eq, Generic) instance NFData NewGistFile instance Binary NewGistFile diff --git a/src/GitHub/Data/GitData.hs b/src/GitHub/Data/GitData.hs index d4fd8798..41158632 100644 --- a/src/GitHub/Data/GitData.hs +++ b/src/GitHub/Data/GitData.hs @@ -15,14 +15,14 @@ data CommitQueryOption | CommitQueryAuthor !Text | CommitQuerySince !UTCTime | CommitQueryUntil !UTCTime - deriving (Show, Eq, Ord, Generic, Typeable, Data) + deriving (Show, Eq, Ord, Generic, Data) data Stats = Stats { statsAdditions :: !Int , statsTotal :: !Int , statsDeletions :: !Int } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Stats instance Binary Stats @@ -37,7 +37,7 @@ data Commit = Commit , commitFiles :: !(Vector File) , commitStats :: !(Maybe Stats) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Commit instance Binary Commit @@ -47,7 +47,7 @@ data Tree = Tree , treeUrl :: !URL , treeGitTrees :: !(Vector GitTree) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Tree instance Binary Tree @@ -61,7 +61,7 @@ data GitTree = GitTree , gitTreePath :: !Text , gitTreeMode :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData GitTree instance Binary GitTree @@ -75,7 +75,7 @@ data GitCommit = GitCommit , gitCommitSha :: !(Maybe (Name GitCommit)) , gitCommitParents :: !(Vector Tree) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData GitCommit instance Binary GitCommit @@ -87,7 +87,7 @@ data Blob = Blob , blobSha :: !(Name Blob) , blobSize :: !Int } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Blob instance Binary Blob @@ -98,7 +98,7 @@ data Tag = Tag , tagTarballUrl :: !URL , tagCommit :: !BranchCommit } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Tag instance Binary Tag @@ -107,7 +107,7 @@ data Branch = Branch { branchName :: !Text , branchCommit :: !BranchCommit } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Branch @@ -115,7 +115,7 @@ data BranchCommit = BranchCommit { branchCommitSha :: !Text , branchCommitUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData BranchCommit instance Binary BranchCommit @@ -134,7 +134,7 @@ data Diff = Diff , diffDiffUrl :: !URL , diffPermalinkUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Diff instance Binary Diff @@ -143,7 +143,7 @@ data NewGitReference = NewGitReference { newGitReferenceRef :: !Text , newGitReferenceSha :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData NewGitReference instance Binary NewGitReference @@ -153,7 +153,7 @@ data GitReference = GitReference , gitReferenceUrl :: !URL , gitReferenceRef :: !(Name GitReference) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData GitReference instance Binary GitReference @@ -163,7 +163,7 @@ data GitObject = GitObject , gitObjectSha :: !Text , gitObjectUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData GitObject instance Binary GitObject @@ -173,7 +173,7 @@ data GitUser = GitUser , gitUserEmail :: !Text , gitUserDate :: !UTCTime } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData GitUser instance Binary GitUser @@ -189,7 +189,7 @@ data File = File , fileFilename :: !Text , fileDeletions :: !Int } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData File instance Binary File diff --git a/src/GitHub/Data/Id.hs b/src/GitHub/Data/Id.hs index ddbc9e25..6c18c2e2 100644 --- a/src/GitHub/Data/Id.hs +++ b/src/GitHub/Data/Id.hs @@ -9,7 +9,7 @@ import Prelude () -- | Numeric identifier. newtype Id entity = Id Int - deriving (Eq, Ord, Show, Generic, Typeable, Data) + deriving (Eq, Ord, Show, Generic, Data) -- | Smart constructor for 'Id'. mkId :: proxy entity -> Int -> Id entity diff --git a/src/GitHub/Data/Invitation.hs b/src/GitHub/Data/Invitation.hs index 3267c2a3..5818a296 100644 --- a/src/GitHub/Data/Invitation.hs +++ b/src/GitHub/Data/Invitation.hs @@ -19,7 +19,7 @@ data Invitation = Invitation , invitationCreatedAt :: !UTCTime , inviter :: !SimpleUser } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Invitation instance Binary Invitation @@ -41,7 +41,7 @@ data InvitationRole | InvitationRoleHiringManager | InvitationRoleReinstate deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance NFData InvitationRole instance Binary InvitationRole @@ -65,7 +65,7 @@ data RepoInvitation = RepoInvitation , repoInvitationPermission :: !Text , repoInvitationHtmlUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RepoInvitation instance Binary RepoInvitation diff --git a/src/GitHub/Data/Issues.hs b/src/GitHub/Data/Issues.hs index 99928ece..2f815c0d 100644 --- a/src/GitHub/Data/Issues.hs +++ b/src/GitHub/Data/Issues.hs @@ -33,7 +33,7 @@ data Issue = Issue , issueMilestone :: !(Maybe Milestone) , issueStateReason :: !(Maybe IssueStateReason) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Issue instance Binary Issue @@ -45,7 +45,7 @@ data NewIssue = NewIssue , newIssueMilestone :: !(Maybe (Id Milestone)) , newIssueLabels :: !(Maybe (Vector (Name IssueLabel))) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData NewIssue instance Binary NewIssue @@ -58,7 +58,7 @@ data EditIssue = EditIssue , editIssueMilestone :: !(Maybe (Id Milestone)) , editIssueLabels :: !(Maybe (Vector (Name IssueLabel))) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData EditIssue instance Binary EditIssue @@ -72,7 +72,7 @@ data IssueComment = IssueComment , issueCommentBody :: !Text , issueCommentId :: !Int } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData IssueComment instance Binary IssueComment @@ -106,7 +106,7 @@ data EventType | MovedColumnsInProject -- ^ The issue was moved between columns in a project board. | RemovedFromProject -- ^ The issue was removed from a project board. | ConvertedNoteToIssue -- ^ The issue was created by converting a note in a project board to an issue. - deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) instance NFData EventType instance Binary EventType @@ -122,7 +122,7 @@ data IssueEvent = IssueEvent , issueEventIssue :: !(Maybe Issue) , issueEventLabel :: !(Maybe IssueLabel) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData IssueEvent instance Binary IssueEvent diff --git a/src/GitHub/Data/Milestone.hs b/src/GitHub/Data/Milestone.hs index aa907999..789b2324 100644 --- a/src/GitHub/Data/Milestone.hs +++ b/src/GitHub/Data/Milestone.hs @@ -18,7 +18,7 @@ data Milestone = Milestone , milestoneCreatedAt :: !UTCTime , milestoneState :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Milestone instance Binary Milestone @@ -42,7 +42,7 @@ data NewMilestone = NewMilestone , newMilestoneDescription :: !(Maybe Text) , newMilestoneDueOn :: !(Maybe UTCTime) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData NewMilestone instance Binary NewMilestone @@ -65,7 +65,7 @@ data UpdateMilestone = UpdateMilestone , updateMilestoneDescription :: !(Maybe Text) , updateMilestoneDueOn :: !(Maybe UTCTime) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData UpdateMilestone instance Binary UpdateMilestone diff --git a/src/GitHub/Data/Name.hs b/src/GitHub/Data/Name.hs index 99554287..a9ecf8e5 100644 --- a/src/GitHub/Data/Name.hs +++ b/src/GitHub/Data/Name.hs @@ -11,7 +11,7 @@ import Data.Aeson.Types (FromJSONKey (..), ToJSONKey (..), fromJSONKeyCoerce, toJSONKeyText) newtype Name entity = N Text - deriving (Eq, Ord, Show, Generic, Typeable, Data) + deriving (Eq, Ord, Show, Generic, Data) -- | Smart constructor for 'Name' mkName :: proxy entity -> Text -> Name entity diff --git a/src/GitHub/Data/Options.hs b/src/GitHub/Data/Options.hs index 33899fbe..da137f0f 100644 --- a/src/GitHub/Data/Options.hs +++ b/src/GitHub/Data/Options.hs @@ -104,7 +104,7 @@ data IssueState = StateOpen | StateClosed deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance ToJSON IssueState where toJSON StateOpen = String "open" @@ -126,7 +126,7 @@ data IssueStateReason | StateReasonNotPlanned | StateReasonReopened deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance ToJSON IssueStateReason where toJSON = String . \case @@ -156,7 +156,7 @@ data MergeableState | StateBehind | StateDraft deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance ToJSON MergeableState where toJSON StateUnknown = String "unknown" @@ -185,7 +185,7 @@ data SortDirection = SortAscending | SortDescending deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance NFData SortDirection instance Binary SortDirection @@ -198,7 +198,7 @@ data SortPR | SortPRPopularity | SortPRLongRunning deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance NFData SortPR instance Binary SortPR @@ -211,7 +211,7 @@ data IssueFilter | IssueFilterSubscribed | IssueFilterAll deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance NFData IssueFilter instance Binary IssueFilter @@ -221,7 +221,7 @@ data SortIssue | SortIssueUpdated | SortIssueComments deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance NFData SortIssue instance Binary SortIssue @@ -234,7 +234,7 @@ data FilterBy a -- ^ e.g. for milestones "any" means "any milestone". -- I.e. won't show issues without mileston specified deriving - (Eq, Ord, Show, Generic, Typeable, Data) + (Eq, Ord, Show, Generic, Data) -- Actions cache @@ -243,7 +243,7 @@ data SortCache | SortCacheLastAccessedAt | SortCacheSizeInBytes deriving - (Eq, Ord, Show, Enum, Bounded, Generic, Typeable, Data) + (Eq, Ord, Show, Enum, Bounded, Generic, Data) instance NFData SortCache instance Binary SortCache @@ -334,7 +334,7 @@ data PullRequestOptions = PullRequestOptions , pullRequestOptionsDirection :: !SortDirection } deriving - (Eq, Ord, Show, Generic, Typeable, Data) + (Eq, Ord, Show, Generic, Data) defaultPullRequestOptions :: PullRequestOptions defaultPullRequestOptions = PullRequestOptions @@ -429,7 +429,7 @@ data IssueOptions = IssueOptions , issueOptionsSince :: !(Maybe UTCTime) } deriving - (Eq, Ord, Show, Generic, Typeable, Data) + (Eq, Ord, Show, Generic, Data) defaultIssueOptions :: IssueOptions defaultIssueOptions = IssueOptions @@ -575,7 +575,7 @@ data IssueRepoOptions = IssueRepoOptions , issueRepoOptionsSince :: !(Maybe UTCTime) -- ^ 'HasSince' } deriving - (Eq, Ord, Show, Generic, Typeable, Data) + (Eq, Ord, Show, Generic, Data) defaultIssueRepoOptions :: IssueRepoOptions defaultIssueRepoOptions = IssueRepoOptions @@ -714,7 +714,7 @@ data ArtifactOptions = ArtifactOptions { artifactOptionsName :: !(Maybe Text) } deriving - (Eq, Ord, Show, Generic, Typeable, Data) + (Eq, Ord, Show, Generic, Data) defaultArtifactOptions :: ArtifactOptions defaultArtifactOptions = ArtifactOptions @@ -763,7 +763,7 @@ data CacheOptions = CacheOptions , cacheOptionsDirection :: !(Maybe SortDirection) } deriving - (Eq, Ord, Show, Generic, Typeable, Data) + (Eq, Ord, Show, Generic, Data) defaultCacheOptions :: CacheOptions defaultCacheOptions = CacheOptions @@ -863,7 +863,7 @@ data WorkflowRunOptions = WorkflowRunOptions , workflowRunOptionsHeadSha :: !(Maybe Text) } deriving - (Eq, Ord, Show, Generic, Typeable, Data) + (Eq, Ord, Show, Generic, Data) defaultWorkflowRunOptions :: WorkflowRunOptions defaultWorkflowRunOptions = WorkflowRunOptions diff --git a/src/GitHub/Data/PublicSSHKeys.hs b/src/GitHub/Data/PublicSSHKeys.hs index 125cd4aa..a7bf18f9 100644 --- a/src/GitHub/Data/PublicSSHKeys.hs +++ b/src/GitHub/Data/PublicSSHKeys.hs @@ -14,7 +14,7 @@ data PublicSSHKeyBasic = PublicSSHKeyBasic { basicPublicSSHKeyId :: !(Id PublicSSHKey) , basicPublicSSHKeyKey :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance FromJSON PublicSSHKeyBasic where parseJSON = withObject "PublicSSHKeyBasic" $ \o -> PublicSSHKeyBasic @@ -30,7 +30,7 @@ data PublicSSHKey = PublicSSHKey , publicSSHKeyCreatedAt :: !(Maybe UTCTime) , publicSSHKeyReadOnly :: !Bool } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance FromJSON PublicSSHKey where parseJSON = withObject "PublicSSHKey" $ \o -> PublicSSHKey @@ -46,7 +46,7 @@ data NewPublicSSHKey = NewPublicSSHKey { newPublicSSHKeyKey :: !Text , newPublicSSHKeyTitle :: !Text } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance ToJSON NewPublicSSHKey where toJSON (NewPublicSSHKey key title) = object diff --git a/src/GitHub/Data/PullRequests.hs b/src/GitHub/Data/PullRequests.hs index 660fd0a5..74370960 100644 --- a/src/GitHub/Data/PullRequests.hs +++ b/src/GitHub/Data/PullRequests.hs @@ -43,7 +43,7 @@ data SimplePullRequest = SimplePullRequest , simplePullRequestTitle :: !Text , simplePullRequestId :: !(Id PullRequest) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData SimplePullRequest instance Binary SimplePullRequest @@ -81,7 +81,7 @@ data PullRequest = PullRequest , pullRequestMergeable :: !(Maybe Bool) , pullRequestMergeableState :: !MergeableState } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData PullRequest instance Binary PullRequest @@ -122,7 +122,7 @@ data PullRequestLinks = PullRequestLinks , pullRequestLinksHtml :: !URL , pullRequestLinksSelf :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData PullRequestLinks instance Binary PullRequestLinks @@ -134,7 +134,7 @@ data PullRequestCommit = PullRequestCommit , pullRequestCommitUser :: !SimpleUser , pullRequestCommitRepo :: !(Maybe Repo) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData PullRequestCommit instance Binary PullRequestCommit @@ -146,7 +146,7 @@ data PullRequestEvent = PullRequestEvent , pullRequestRepository :: !Repo , pullRequestSender :: !SimpleUser } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData PullRequestEvent instance Binary PullRequestEvent @@ -163,7 +163,7 @@ data PullRequestEventType | PullRequestReviewRequested | PullRequestReviewRequestRemoved | PullRequestEdited - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData PullRequestEventType instance Binary PullRequestEventType @@ -173,7 +173,7 @@ data PullRequestReference = PullRequestReference , pullRequestReferencePatchUrl :: !(Maybe URL) , pullRequestReferenceDiffUrl :: !(Maybe URL) } - deriving (Eq, Ord, Show, Generic, Typeable, Data) + deriving (Eq, Ord, Show, Generic, Data) instance NFData PullRequestReference instance Binary PullRequestReference @@ -316,4 +316,4 @@ data MergeResult = MergeSuccessful | MergeCannotPerform | MergeConflict - deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Typeable) + deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic) diff --git a/src/GitHub/Data/RateLimit.hs b/src/GitHub/Data/RateLimit.hs index d2b98d73..743a096e 100644 --- a/src/GitHub/Data/RateLimit.hs +++ b/src/GitHub/Data/RateLimit.hs @@ -13,7 +13,7 @@ data Limits = Limits , limitsRemaining :: !Int , limitsReset :: !SystemTime } - deriving (Show, {- Data, -} Typeable, Eq, Ord, Generic) + deriving (Show, Eq, Ord, Generic) instance NFData Limits instance Binary Limits @@ -29,7 +29,7 @@ data RateLimit = RateLimit , rateLimitSearch :: Limits , rateLimitGraphQL :: Limits } - deriving (Show, {- Data, -} Typeable, Eq, Ord, Generic) + deriving (Show, Eq, Ord, Generic) instance NFData RateLimit instance Binary RateLimit diff --git a/src/GitHub/Data/Reactions.hs b/src/GitHub/Data/Reactions.hs index ade4ec7b..574fda00 100644 --- a/src/GitHub/Data/Reactions.hs +++ b/src/GitHub/Data/Reactions.hs @@ -13,7 +13,7 @@ data Reaction = Reaction , reactionContent :: !ReactionContent , reactionCreatedAt :: !UTCTime } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Reaction instance Binary Reaction @@ -21,7 +21,7 @@ instance Binary Reaction data NewReaction = NewReaction { newReactionContent :: !ReactionContent } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData NewReaction instance Binary NewReaction @@ -37,7 +37,7 @@ data ReactionContent | Hooray | Rocket | Eyes - deriving (Show, Data, Typeable, Eq, Ord, Enum, Bounded, Generic) + deriving (Show, Data, Eq, Ord, Enum, Bounded, Generic) instance NFData ReactionContent instance Binary ReactionContent diff --git a/src/GitHub/Data/Releases.hs b/src/GitHub/Data/Releases.hs index 0f9c40b7..7f87b825 100644 --- a/src/GitHub/Data/Releases.hs +++ b/src/GitHub/Data/Releases.hs @@ -25,7 +25,7 @@ data Release = Release , releaseAuthor :: !SimpleUser , releaseAssets :: !(Vector ReleaseAsset) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance FromJSON Release where parseJSON = withObject "Event" $ \o -> Release @@ -64,7 +64,7 @@ data ReleaseAsset = ReleaseAsset , releaseAssetUpdatedAt :: !UTCTime , releaseAssetUploader :: !SimpleUser } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance FromJSON ReleaseAsset where parseJSON = withObject "Event" $ \o -> ReleaseAsset diff --git a/src/GitHub/Data/Repos.hs b/src/GitHub/Data/Repos.hs index 8964c00b..6dce3919 100644 --- a/src/GitHub/Data/Repos.hs +++ b/src/GitHub/Data/Repos.hs @@ -53,7 +53,7 @@ data Repo = Repo , repoUpdatedAt :: !(Maybe UTCTime) , repoPermissions :: !(Maybe RepoPermissions) -- ^ Repository permissions as they relate to the authenticated user. } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Repo instance Binary Repo @@ -88,7 +88,7 @@ data CodeSearchRepo = CodeSearchRepo , codeSearchRepoUpdatedAt :: !(Maybe UTCTime) , codeSearchRepoPermissions :: !(Maybe RepoPermissions) -- ^ Repository permissions as they relate to the authenticated user. } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData CodeSearchRepo instance Binary CodeSearchRepo @@ -101,7 +101,7 @@ data RepoPermissions = RepoPermissions , repoPermissionPush :: !Bool , repoPermissionPull :: !Bool } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RepoPermissions instance Binary RepoPermissions @@ -110,7 +110,7 @@ data RepoRef = RepoRef { repoRefOwner :: !SimpleOwner , repoRefRepo :: !(Name Repo) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RepoRef instance Binary RepoRef @@ -129,7 +129,7 @@ data NewRepo = NewRepo , newRepoAllowSquashMerge :: !(Maybe Bool) , newRepoAllowMergeCommit :: !(Maybe Bool) , newRepoAllowRebaseMerge :: !(Maybe Bool) - } deriving (Eq, Ord, Show, Data, Typeable, Generic) + } deriving (Eq, Ord, Show, Data, Generic) instance NFData NewRepo instance Binary NewRepo @@ -151,7 +151,7 @@ data EditRepo = EditRepo , editAllowRebaseMerge :: !(Maybe Bool) , editArchived :: !(Maybe Bool) } - deriving (Eq, Ord, Show, Data, Typeable, Generic) + deriving (Eq, Ord, Show, Data, Generic) instance NFData EditRepo instance Binary EditRepo @@ -163,14 +163,14 @@ data RepoPublicity | RepoPublicityPublic -- ^ Only public repos. | RepoPublicityPrivate -- ^ Only private repos. | RepoPublicityMember -- ^ Only repos to which the user is a member but not an owner. - deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic) + deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) -- | The value is the number of bytes of code written in that language. type Languages = HM.HashMap Language Int -- | A programming language. newtype Language = Language Text - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) getLanguage :: Language -> Text getLanguage (Language l) = l @@ -188,7 +188,7 @@ data Contributor = KnownContributor !Int !URL !(Name User) !URL !(Id User) !Text -- | An unknown Github user with their number of contributions and recorded name. | AnonymousContributor !Int !Text - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Contributor instance Binary Contributor @@ -205,7 +205,7 @@ data CollaboratorPermission | CollaboratorPermissionWrite | CollaboratorPermissionRead | CollaboratorPermissionNone - deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) instance NFData CollaboratorPermission instance Binary CollaboratorPermission @@ -214,7 +214,7 @@ instance Binary CollaboratorPermission -- See data CollaboratorWithPermission = CollaboratorWithPermission SimpleUser CollaboratorPermission - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData CollaboratorWithPermission instance Binary CollaboratorWithPermission @@ -381,7 +381,7 @@ instance FromJSONKey Language where data ArchiveFormat = ArchiveFormatTarball -- ^ ".tar.gz" format | ArchiveFormatZipball -- ^ ".zip" format - deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic) + deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) instance IsPathPart ArchiveFormat where toPathPart af = case af of diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index 0ff3ae1b..07ac89dd 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -61,7 +61,7 @@ data CommandMethod | Patch | Put | Delete - deriving (Eq, Ord, Read, Show, Enum, Bounded, Typeable, Data, Generic) + deriving (Eq, Ord, Read, Show, Enum, Bounded, Data, Generic) instance Hashable CommandMethod @@ -81,7 +81,7 @@ data FetchCount = FetchAtLeast !Word | FetchAll | FetchPage PageParams - deriving (Eq, Ord, Read, Show, Generic, Typeable) + deriving (Eq, Ord, Read, Show, Generic) -- | This instance is there mostly for 'fromInteger'. @@ -111,7 +111,7 @@ data PageParams = PageParams { pageParamsPerPage :: Maybe Int , pageParamsPage :: Maybe Int } - deriving (Eq, Ord, Read, Show, Generic, Typeable) + deriving (Eq, Ord, Read, Show, Generic) instance Hashable PageParams instance Binary PageParams @@ -129,7 +129,7 @@ data PageLinks = PageLinks { , pageLinksLast :: Maybe URI , pageLinksFirst :: Maybe URI } - deriving (Eq, Ord, Show, Generic, Typeable) + deriving (Eq, Ord, Show, Generic) instance NFData PageLinks @@ -148,7 +148,7 @@ data MediaType a | MtStatus -- ^ Parse status | MtUnit -- ^ Always succeeds | MtPreview a -- ^ Some other (preview) type; this is an extension point. - deriving (Eq, Ord, Read, Show, Typeable, Data, Generic) + deriving (Eq, Ord, Read, Show, Data, Generic) ------------------------------------------------------------------------------ -- RW @@ -160,7 +160,7 @@ data RW = RO -- ^ /Read-only/, doesn't necessarily requires authentication | RA -- ^ /Read authenticated/ | RW -- ^ /Read-write/, requires authentication - deriving (Eq, Ord, Read, Show, Enum, Bounded, Typeable, Data, Generic) + deriving (Eq, Ord, Read, Show, Enum, Bounded, Data, Generic) {- data SRO (rw :: RW) where @@ -194,7 +194,6 @@ data GenRequest (mt :: MediaType *) (rw :: RW) a where -> Paths -- ^ path -> LBS.ByteString -- ^ body -> GenRequest mt 'RW a - deriving (Typeable) -- | Most requests ask for @JSON@. type Request = GenRequest 'MtJSON diff --git a/src/GitHub/Data/Search.hs b/src/GitHub/Data/Search.hs index fd333482..a84710d2 100644 --- a/src/GitHub/Data/Search.hs +++ b/src/GitHub/Data/Search.hs @@ -11,7 +11,7 @@ data SearchResult' entities = SearchResult { searchResultTotalCount :: !Int , searchResultResults :: !entities } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) type SearchResult entity = SearchResult' (V.Vector entity) @@ -38,7 +38,7 @@ data Code = Code , codeHtmlUrl :: !URL , codeRepo :: !CodeSearchRepo } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Code instance Binary Code diff --git a/src/GitHub/Data/Statuses.hs b/src/GitHub/Data/Statuses.hs index 5b488920..a2e19219 100644 --- a/src/GitHub/Data/Statuses.hs +++ b/src/GitHub/Data/Statuses.hs @@ -1,7 +1,5 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE OverloadedStrings #-} + module GitHub.Data.Statuses where import GitHub.Data.Definitions @@ -21,7 +19,7 @@ data StatusState | StatusSuccess | StatusError | StatusFailure - deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) instance NFData StatusState instance Binary StatusState @@ -52,7 +50,7 @@ data Status = Status , statusContext :: !(Maybe Text) , statusCreator :: !(Maybe SimpleUser) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance FromJSON Status where parseJSON = withObject "Status" $ \o -> Status @@ -73,7 +71,7 @@ data NewStatus = NewStatus , newStatusDescription :: !(Maybe Text) , newStatusContext :: !(Maybe Text) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData NewStatus instance Binary NewStatus @@ -99,7 +97,7 @@ data CombinedStatus = CombinedStatus , combinedStatusCommitUrl :: !URL , combinedStatusUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance FromJSON CombinedStatus where parseJSON = withObject "CombinedStatus" $ \o -> CombinedStatus diff --git a/src/GitHub/Data/Teams.hs b/src/GitHub/Data/Teams.hs index 4f3da777..01b1429c 100644 --- a/src/GitHub/Data/Teams.hs +++ b/src/GitHub/Data/Teams.hs @@ -1,7 +1,4 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE OverloadedStrings #-} module GitHub.Data.Teams where @@ -18,7 +15,7 @@ import qualified Data.Text as T data Privacy = PrivacyClosed | PrivacySecret - deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) instance NFData Privacy instance Binary Privacy @@ -27,7 +24,7 @@ data Permission = PermissionPull | PermissionPush | PermissionAdmin - deriving (Show, Data, Enum, Bounded, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Enum, Bounded, Eq, Ord, Generic) instance NFData Permission instance Binary Permission @@ -35,7 +32,7 @@ instance Binary Permission data AddTeamRepoPermission = AddTeamRepoPermission { addTeamRepoPermission :: !Permission } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData AddTeamRepoPermission instance Binary AddTeamRepoPermission @@ -51,7 +48,7 @@ data SimpleTeam = SimpleTeam , simpleTeamMembersUrl :: !URL , simpleTeamRepositoriesUrl :: !URL } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData SimpleTeam instance Binary SimpleTeam @@ -70,7 +67,7 @@ data Team = Team , teamReposCount :: !Int , teamOrganization :: !SimpleOrganization } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Team instance Binary Team @@ -82,7 +79,7 @@ data CreateTeam = CreateTeam , createTeamPrivacy :: !Privacy , createTeamPermission :: !Permission } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData CreateTeam instance Binary CreateTeam @@ -93,7 +90,7 @@ data EditTeam = EditTeam , editTeamPrivacy :: !(Maybe Privacy) , editTeamPermission :: !(Maybe Permission) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData EditTeam instance Binary EditTeam @@ -101,7 +98,7 @@ instance Binary EditTeam data Role = RoleMaintainer | RoleMember - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData Role instance Binary Role @@ -109,7 +106,7 @@ instance Binary Role data ReqState = StatePending | StateActive - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData ReqState instance Binary ReqState @@ -119,14 +116,14 @@ data TeamMembership = TeamMembership , teamMembershipRole :: !Role , teamMembershipReqState :: !ReqState } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData TeamMembership instance Binary TeamMembership data CreateTeamMembership = CreateTeamMembership { createTeamMembershipRole :: !Role -} deriving (Show, Data, Typeable, Eq, Ord, Generic) +} deriving (Show, Data, Eq, Ord, Generic) instance NFData CreateTeamMembership instance Binary CreateTeamMembership @@ -254,4 +251,4 @@ data TeamMemberRole = TeamMemberRoleAll -- ^ all members of the team. | TeamMemberRoleMaintainer -- ^ team maintainers | TeamMemberRoleMember -- ^ normal members of the team. - deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic) + deriving (Show, Eq, Ord, Enum, Bounded, Data, Generic) diff --git a/src/GitHub/Data/URL.hs b/src/GitHub/Data/URL.hs index c3d9edcc..69ddde70 100644 --- a/src/GitHub/Data/URL.hs +++ b/src/GitHub/Data/URL.hs @@ -10,7 +10,7 @@ import Prelude () -- -- /N.B./ syntactical validity is not verified. newtype URL = URL Text - deriving (Eq, Ord, Show, Generic, Typeable, Data) + deriving (Eq, Ord, Show, Generic, Data) getUrl :: URL -> Text getUrl (URL url) = url diff --git a/src/GitHub/Data/Webhooks.hs b/src/GitHub/Data/Webhooks.hs index 32e97287..7d2bac40 100644 --- a/src/GitHub/Data/Webhooks.hs +++ b/src/GitHub/Data/Webhooks.hs @@ -20,7 +20,7 @@ data RepoWebhook = RepoWebhook , repoWebhookUpdatedAt :: !UTCTime , repoWebhookCreatedAt :: !UTCTime } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RepoWebhook instance Binary RepoWebhook @@ -85,7 +85,7 @@ data RepoWebhookEvent | WebhookWatchEvent | WebhookWorkflowDispatch | WebhookWorkflowRun - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RepoWebhookEvent instance Binary RepoWebhookEvent @@ -95,7 +95,7 @@ data RepoWebhookResponse = RepoWebhookResponse , repoWebhookResponseStatus :: !(Maybe Text) , repoWebhookResponseMessage :: !(Maybe Text) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData RepoWebhookResponse instance Binary RepoWebhookResponse @@ -105,7 +105,7 @@ data PingEvent = PingEvent , pingEventHook :: !RepoWebhook , pingEventHookId :: !(Id RepoWebhook) } - deriving (Show, Data, Typeable, Eq, Ord, Generic) + deriving (Show, Data, Eq, Ord, Generic) instance NFData PingEvent instance Binary PingEvent @@ -116,7 +116,7 @@ data NewRepoWebhook = NewRepoWebhook , newRepoWebhookEvents :: !(Maybe (Vector RepoWebhookEvent)) , newRepoWebhookActive :: !(Maybe Bool) } - deriving (Eq, Ord, Show, Typeable, Data, Generic) + deriving (Eq, Ord, Show, Data, Generic) instance NFData NewRepoWebhook instance Binary NewRepoWebhook @@ -128,7 +128,7 @@ data EditRepoWebhook = EditRepoWebhook , editRepoWebhookRemoveEvents :: !(Maybe (Vector RepoWebhookEvent)) , editRepoWebhookActive :: !(Maybe Bool) } - deriving (Eq, Ord, Show, Typeable, Data, Generic) + deriving (Eq, Ord, Show, Data, Generic) instance NFData EditRepoWebhook instance Binary EditRepoWebhook diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index 03a38b13..a001da65 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -13,7 +13,7 @@ import Data.Aeson as X import Data.Aeson.Types as X (emptyObject, typeMismatch) import Data.Binary as X (Binary) import Data.Binary.Instances as X () -import Data.Data as X (Data, Typeable) +import Data.Data as X (Data) import Data.Foldable as X (toList) import Data.Hashable as X (Hashable (..)) import Data.HashMap.Strict as X (HashMap) From 0c07f9e17076dfd67fe82d0b5cada98d961964a9 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 27 Aug 2025 12:56:31 +0200 Subject: [PATCH 119/121] Bump to v0.30.0.1 and CHANGELOG, bump Haskell CI to 9.14 alpha1 --- .github/workflows/haskell-ci.yml | 57 ++++++++++++++++++++++++++++---- CHANGELOG.md | 9 +++++ github.cabal | 3 +- samples/github-samples.cabal | 1 + 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index bb4e2c16..b6ee1af9 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.19.20250506 +# version: 0.19.20250821 # -# REGENDATA ("0.19.20250506",["--config=cabal.haskell-ci","github","cabal.project"]) +# REGENDATA ("0.19.20250821",["--config=cabal.haskell-ci","github","cabal.project"]) # name: Haskell-CI on: @@ -32,6 +32,11 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.14.0.20250819 + compilerKind: ghc + compilerVersion: 9.14.0.20250819 + setup-method: ghcup-prerelease + allow-failure: false - compiler: ghc-9.12.2 compilerKind: ghc compilerVersion: 9.12.2 @@ -105,8 +110,8 @@ jobs: chmod a+x "$HOME/.ghcup/bin/ghcup" - name: Install cabal-install run: | - "$HOME/.ghcup/bin/ghcup" install cabal 3.14.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - echo "CABAL=$HOME/.ghcup/bin/cabal-3.14.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + "$HOME/.ghcup/bin/ghcup" install cabal 3.16.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.16.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" - name: Install GHC (GHCup) if: matrix.setup-method == 'ghcup' run: | @@ -121,6 +126,21 @@ jobs: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} HCVER: ${{ matrix.compilerVersion }} + - name: Install GHC (GHCup prerelease) + if: matrix.setup-method == 'ghcup-prerelease' + run: | + "$HOME/.ghcup/bin/ghcup" config add-release-channel prereleases + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} - name: Set PATH and environment variables run: | echo "$HOME/.cabal/bin" >> $GITHUB_PATH @@ -131,7 +151,7 @@ jobs: echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + if [ $((HCNUMVER >= 91400)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} @@ -159,6 +179,18 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + if $HEADHACKAGE; then + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "packages: ${PKGDIR_github_samples}" >> cabal.project ; fi echo "package github" >> cabal.project - echo " ghc-options: -Werror=missing-methods" >> cabal.project + echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi - if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi + if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project ; fi cat >> cabal.project <> cabal.project + fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(github|github-samples)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local diff --git a/CHANGELOG.md b/CHANGELOG.md index 45c00f5a..014e7e29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## Changes for 0.30.0.1 + +_2025-08-27, Andreas Abel_ + +- Drop dependencies `deepseq-generics` and `transformers-compat`. +- Remove obsolete `deriving Typeable`. + +Tested with GHC 8.2 - 9.14 alpha1. + ## Changes for 0.30 _2025-05-09, Andreas Abel, Peace edition_ diff --git a/github.cabal b/github.cabal index 54f0d2a1..759c9f95 100644 --- a/github.cabal +++ b/github.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: github -version: 0.30 +version: 0.30.0.1 synopsis: Access to the GitHub API, v3. category: Network description: @@ -30,6 +30,7 @@ copyright: Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley, Copyright 2016-2021 Oleg Grenrus tested-with: + GHC == 9.14.1 GHC == 9.12.2 GHC == 9.10.2 GHC == 9.8.4 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index 2fd3287a..d58512a7 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -10,6 +10,7 @@ description: Various samples of github package build-type: Simple tested-with: + GHC == 9.14.1 GHC == 9.12.2 GHC == 9.10.2 GHC == 9.8.4 From 4adbc91b2192eb5d6b1c7c59552d93cfa6ddfca4 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 27 Aug 2025 15:59:20 +0200 Subject: [PATCH 120/121] Silence -Wincomplete-uni-patterns in testsuite (for Haskell CI) --- spec/GitHub/ReposSpec.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/GitHub/ReposSpec.hs b/spec/GitHub/ReposSpec.hs index 45c32415..9ccc7066 100644 --- a/spec/GitHub/ReposSpec.hs +++ b/spec/GitHub/ReposSpec.hs @@ -1,4 +1,10 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} + +#if __GLASGOW_HASKELL__ >= 900 +{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} +#endif + module GitHub.ReposSpec where import GitHub From e42e78961099e80cb18d05386b574e4bc87187d2 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 27 Aug 2025 16:19:56 +0200 Subject: [PATCH 121/121] Haskell CI: turn of -Werror=unused-packages; hopeless for github-samples --- .github/workflows/haskell-ci.yml | 4 ---- cabal.haskell-ci | 5 +++++ samples/github-samples.cabal | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index b6ee1af9..2e003f87 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -246,10 +246,6 @@ jobs: echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi if [ $((HCNUMVER >= 80400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project ; fi - if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi - if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi - if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi - if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package github" >> cabal.project ; fi if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project ; fi if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package github-samples" >> cabal.project ; fi diff --git a/cabal.haskell-ci b/cabal.haskell-ci index ccddf4a2..e44b77d2 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -3,6 +3,11 @@ haddock: >=8.6 -- See PR #355: haddocks for GADT constructor arguments only supported from GHC 8.6 jobs-selection: any +-- Package github-samples uses "include" for dependencies, +-- so they are a superset. +-- Dissecting this is a waste of time, so I turn -Werror=unused-packages off +error-unused-packages: False + -- Some dependencies do not allow mtl-2.3 yet, so this doesn't pass yet: -- constraint-set mtl-2.3 -- ghc: >= 8.6 diff --git a/samples/github-samples.cabal b/samples/github-samples.cabal index d58512a7..2e7a8699 100644 --- a/samples/github-samples.cabal +++ b/samples/github-samples.cabal @@ -29,7 +29,6 @@ library build-depends: , base >=4.11 && <5 -- require base-4.11 because then (<>) is in Prelude - , base-compat-batteries , github , text