BSD-3-Clause licensed by Rob Stewart
Maintained by [email protected]
This version can be pinned in stack with:gitlab-haskell-0.2.4@sha256:b3a940bf99938fdb58ecc58a5bc77a350882de9a5a8aeeb446d591a3e5fbe418,4221

A Haskell library for the GitLab web API

This library interacts with a GitLab server’s API. It supports queries about and updates to:

  • Branches
  • Commits
  • Groups
  • Issues
  • Jobs
  • Members
  • Merge requests
  • Pipelines
  • Projects
  • Repositories
  • Repository files
  • Users

The library parses JSON results into Haskell data types in the GitLab.Types module.

Example

Run all GitLab actions with runGitLab:

runGitLab ::
   => GitLabServerConfig
   -> GitLab a
   -> IO a

For example:

myProjects <-
  runGitLab
    (defaultGitLabServer
       { url = "https://gitlab.example.com"
       , token="my_token"} )
    (searchUser "joe" >>= userProjects . fromJust)

Which uses the functions:

searchUser     :: Text -> GitLab (Maybe User)
userProjects   :: User -> GitLab (Maybe [Project])
projectCommits :: Project -> GitLab [Commit]

This library can also be used to implement rule based GitLab file system hooks that, when deployed a GitLab server, react in real time to GitLab events like project creation, new users, merge requests etc.

The rule based API for implementing file hooks is:

receive :: [Rule] -> GitLab ()

class (FromJSON a) => SystemHook a where
  match   :: String -> (a -> GitLab ()) -> Rule
  matchIf :: String -> (a -> GitLab Bool) -> (a -> GitLab ()) -> Rule

For more details about the file system hooks support, see post: GitLab automation with file hook rules.

For the complete gitlab-haskell API, see the hackage documentation.

The gitlab-tools command line tool for bulk GitLab transactions uses this library link.