CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/golang-github-com-google-go-github

Go client library for accessing the GitHub API v3

Agent Success

Agent success rate when using this tile

65%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.14x

Baseline

Agent success rate without this tile

57%

Overview
Eval results
Files

task.mdevals/scenario-8/

Versioned Audit Exporter

Fetch organization audit log entries while enforcing custom API version headers, optional preview media types, and mixed pagination tokens from GitHub responses.

Capabilities

Version and preview headers

  • Building the client requires an API version string; every request must include that version header. @test
  • When preview mode is enabled, requests to the preview-only audit log endpoint include the required preview Accept header; when disabled, the header is not sent. @test

Pagination across tokens and pages

  • Fetching audit log pages supports both numeric page/per_page options and handling before/after pagination tokens returned by the API; the function returns the next page number and any pagination tokens from the response. @test
  • An aggregation helper continues until no further page numbers or pagination tokens are available and returns all entries in order. @test

Implementation

@generates

API

package versionedaudit

type Config struct {
    // Personal access token used for authentication.
    Token string
    // Required API version header value.
    Version string
    // Toggle to include the preview Accept header for audit log endpoints.
    EnablePreview bool
    // Organization login to fetch audit events for.
    Org string
    // Optional page size to apply to paginated requests.
    PageSize int
}

type Entry struct {
    Action string
    Actor  string
    Repo   string
    // Timestamp ISO 8601 string.
    OccurredAt string
    // Raw payload for assertions.
    Raw map[string]any
}

type PageInfo struct {
    // Next numeric page index if provided by the API; zero when absent.
    NextPage int
    // Forward pagination token (e.g., "after") from the response; empty when absent.
    NextToken string
    // Backward pagination token (e.g., "before") from the response; empty when absent.
    PrevToken string
}

type Client interface {
    // Fetches a single page of audit log entries, honoring the requested page number and/or pagination token.
    FetchAuditPage(ctx context.Context, page int, token string) (entries []Entry, pageInfo PageInfo, err error)
    // Fetches all audit log entries starting at the first page, following mixed pagination tokens until no further results remain.
    FetchAll(ctx context.Context) ([]Entry, error)
}

// NewClient constructs a client using the supplied config and prepares the authenticated HTTP transport.
func NewClient(cfg Config) (Client, error)

Dependencies { .dependencies }

github.com/google/go-github/v80/github { .dependency }

Typed GitHub REST v3 client with helpers for API versioning, preview media types, and pagination metadata.

tessl i tessl/golang-github-com-google-go-github@79.0.1

tile.json