githubapi

package
v0.33.0-rc.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package githubapi provides shared helpers for authenticated GitHub API requests and on-disk JSON caching. Both the EIP and consensus-specs fetchers use these helpers to build requests with optional bearer-token auth from GITHUB_TOKEN or GH_TOKEN environment variables, and to read and write their cache files.

Index

Constants

View Source
const APIBase = "https://api.github.com"

APIBase is the root URL for the GitHub REST API.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(ctx context.Context, url string) (*http.Request, error)

NewRequest creates an HTTP GET request for the GitHub API. If GITHUB_TOKEN or GH_TOKEN is set, a Bearer authorization header is added automatically.

func ReadCache added in v0.30.0

func ReadCache[T any](path string) (*T, error)

ReadCache reads and JSON-decodes a cache file into a value of type T.

func Token

func Token() string

Token returns the first non-empty value from GITHUB_TOKEN or GH_TOKEN.

func WriteCache added in v0.30.0

func WriteCache[T any](path string, cache *T) error

WriteCache JSON-encodes a cache value and writes it to a file.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL