Skip to content

GoGitHub

Build Status Go Report Card Docs License

GoGitHub is a high-level Go module for interacting with the GitHub API. It wraps google/go-github with convenience functions organized by operation type.

Features

  • Search API - Query issues, pull requests, code, and commits with a fluent query builder
  • Repository Operations - Fork, branch, commit, and batch file operations
  • Pull Requests - Create, list, merge, and manage PRs
  • Releases - List releases and download assets
  • GraphQL API - User contribution statistics and detailed commit stats
  • Error Handling - Typed errors with helper functions for common cases
  • GitHub Enterprise - Full support for GitHub Enterprise Server

Quick Example

package main

import (
    "context"
    "fmt"

    "github.com/grokify/gogithub/auth"
    "github.com/grokify/gogithub/search"
)

func main() {
    ctx := context.Background()
    gh := auth.NewGitHubClient(ctx, "your-github-token")

    client := search.NewClient(gh)
    issues, err := client.SearchIssuesAll(ctx, search.Query{
        search.ParamUser:  "grokify",
        search.ParamState: search.ParamStateValueOpen,
        search.ParamIs:    search.ParamIsValuePR,
    }, nil)
    if err != nil {
        panic(err)
    }

    fmt.Printf("Found %d open PRs\n", len(issues))
}

Package Overview

Package Description
auth Authentication and client creation
config Configuration from environment variables
search Search API with query builder
repo Repository operations (fork, branch, commit, batch)
pr Pull request operations
release Release and asset operations
graphql GraphQL API for contribution statistics
errors Error types and translation

Next Steps