Skip to content

Instantly share code, notes, and snippets.

@shapr
Created June 25, 2019 21:58
Show Gist options
  • Save shapr/8e21f63965afb5ce2bfae6da22be6d62 to your computer and use it in GitHub Desktop.
Save shapr/8e21f63965afb5ce2bfae6da22be6d62 to your computer and use it in GitHub Desktop.
remotely create github repo with the v3 API
{-# LANGUAGE OverloadedStrings #-}
module Main where
import GitHub.Endpoints.Repos
-- https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
-- give the token "public_repo" access
-- should be a 40 character string
myauth = OAuth "80....................................2e" -- magically converts to ByteString
mynewrepo = NewRepo { newRepoName = mkName ([] :: [Repo]) "some_repo"
, newRepoDescription = Just "some description"
, newRepoHomepage = Nothing
, newRepoPrivate = Just False
, newRepoHasIssues = Just False
, newRepoHasWiki = Just False
, newRepoAutoInit = Just True -- please create a README.md for me!
}
main :: IO ()
main = do
result <- createRepo' myauth mynewrepo
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment