Repolode
google

google/go-github

Go client library for accessing the GitHub v3 REST API, with typed services for repos, orgs, issues, and more.

Stars
11,340
Forks
2,567
Open issues
29
Last commit
16 hours ago

What is it?

go-github is a Go client library for the GitHub REST API v3. A client is created with the library and then used through service groups that mirror the structure of the GitHub API documentation, such as Repositories, Organizations and Pull Requests. Requests and responses are represented as Go structs, so callers work with typed data rather than raw JSON.

The library covers common concerns that come with calling the API directly. It includes token-based authentication, helpers for detecting primary and secondary rate limit errors, pagination through page numbers or string cursors, and iterator methods built on Go's iter package. It also provides structs and validation helpers for parsing GitHub webhook payloads.

The project targets the two most recent major Go releases, and it is maintained as a Go module with versioned import paths. Caching of conditional requests is left to a caching HTTP transport, which the project recommends pairing with the client.

Key features

  • 01Typed Go structs for GitHub REST API requests and responses.
  • 02Service-based client organized to match the GitHub API documentation.
  • 03Token and GitHub App authentication options.
  • 04Helpers for detecting primary and secondary rate limit errors.
  • 05Pagination support with page-number and cursor iterators.
  • 06Structs and validators for parsing GitHub webhook events.

Use cases

  • Building Go bots or CI tools that read or update repositories, issues, and pull requests.
  • Writing GitHub App backends that handle webhook events in Go.
  • Automating organization administration tasks such as listing members or managing teams.
  • Writing tests against GitHub API behavior using a mock library.

Quick start

  1. 1

    Install the library into your Go module

    go get github.com/google/go-github/v93
  2. 2

    Import the package in your Go code

  3. 3

    Create a client and call the API services

Things to know

  • It requires a recent Go toolchain, specifically the N-1 major release of Go as the minimum.
  • Most endpoints need an access token, so you must configure authentication before making many calls.

Topics

FAQ

What is go-github?
Go client library for accessing the GitHub v3 REST API, with typed services for repos, orgs, issues, and more. go-github is a Go client library for the GitHub REST API v3. A client is created with the library and then used through service groups that mirror the structure of the GitHub API documentation, such as Repositories, Organizations and Pull Requests. Requests and responses are represented as Go structs, so callers work with typed data rather than raw JSON.
Is go-github free to use? What license does it have?
go-github is open source under the BSD-3-Clause license. Check the license terms before using it in commercial products.
Is go-github still maintained?
Actively maintained. The last commit to go-github was on Nov 6, 2026.
What can I use go-github for?
Building Go bots or CI tools that read or update repositories, issues, and pull requests. Writing GitHub App backends that handle webhook events in Go. Automating organization administration tasks such as listing members or managing teams. Writing tests against GitHub API behavior using a mock library.
How do I install go-github?
Install the library into your Go module: go get github.com/google/go-github/v93 Import the package in your Go code Create a client and call the API services
Where can I get go-github?
The source code and installation instructions are on GitHub: https://github.com/google/go-github

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects