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 001/110] 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 002/110] 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 003/110] 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 e712718ff99c1846391ebed9c38ebfb70f7844fa Mon Sep 17 00:00:00 2001
From: Ruud van Asseldonk
Date: Thu, 9 Jan 2020 13:32:03 +0100
Subject: [PATCH 004/110] 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 005/110] 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 006/110] 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 007/110] 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 008/110] 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 009/110] 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 010/110] 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 011/110] 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 012/110] 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 013/110] 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 014/110] 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 015/110] 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 016/110] 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 017/110] 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 018/110] 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 019/110] 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 020/110] 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 021/110] 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 022/110] 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 023/110] 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 024/110] 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 025/110] 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 026/110] 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 027/110] 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 028/110] 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 029/110] 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 030/110] 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 031/110] 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 032/110] 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 033/110] 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 034/110] 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 035/110] 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 036/110] 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 037/110] 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
------
[](https://travis-ci.org/phadej/github)
[][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 038/110] 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 039/110] 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 040/110] 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 041/110] 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 042/110] 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 043/110] 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
------
-[](https://travis-ci.org/phadej/github)
+[](https://github.com/haskell-github/github/actions/workflows/haskell-ci.yml)
[][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 044/110] 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 045/110] 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 046/110] 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 047/110] 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 048/110] 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 049/110] 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 050/110] 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 051/110] 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 052/110] 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 053/110] 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 054/110] 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 055/110] 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 056/110] 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 057/110] 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 058/110] 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 059/110] 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 060/110] 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 061/110] 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 062/110] 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 063/110] 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 064/110] 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 065/110] 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 066/110] 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 067/110] 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 068/110] 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 069/110] 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 070/110] 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
------
+[](http://hackage.haskell.org/package/github)
+[](https://stackage.org/nightly/package/github)
+[](https://www.stackage.org/package/github)
[](https://github.com/haskell-github/github/actions/workflows/haskell-ci.yml)
-[][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 071/110] 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 072/110] 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 073/110] 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 074/110] 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 075/110] 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 076/110] 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 077/110] 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 078/110] 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