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-9/

App Webhook Delivery Toolkit

A Go library that completes GitHub App onboarding, manages installation tokens with expiry-aware caching, and inspects/redelivers app webhook deliveries.

Capabilities

Manifest completion

  • Completing a one-time manifest code exchanges it for app credentials (slug, client credentials, webhook secret, PEM) and returns them together. @test

Installation token refresh

  • Fetching an installation token returns cached data when still valid, and refreshes when the token expires within the configured refresh window while exposing the new expiry timestamp. @test

Delivery listing

  • Listing webhook deliveries returns the most recent deliveries up to a caller-specified limit along with a cursor for the next page. @test

Delivery redelivery

  • Redelivering a specific webhook delivery triggers a new attempt and returns the updated delivery status/details. @test

Implementation

@generates

API

package appmanager

import (
    "context"
    "time"
)

// Client defines the app-scoped GitHub API surface the manager relies on.
type Client interface {
    CompleteManifest(ctx context.Context, code string) (AppSecrets, error)
    CreateInstallationToken(ctx context.Context, installationID int64) (InstallationTokenInfo, error)
    ListWebhookDeliveries(ctx context.Context, limit int, cursor string) (DeliveryPage, error)
    GetWebhookDelivery(ctx context.Context, deliveryID int64) (DeliverySummary, error)
    RedeliverWebhook(ctx context.Context, deliveryID int64) (DeliverySummary, error)
}

// AppManager orchestrates manifest onboarding, token refresh, and webhook delivery controls.
type AppManager struct {
    client        Client
    refreshWindow time.Duration
}

// NewAppManager builds a manager with the provided GitHub App client and refresh window for tokens.
func NewAppManager(client Client, refreshWindow time.Duration) *AppManager

// CompleteManifest exchanges a one-time manifest code for secrets and returns them together.
func (m *AppManager) CompleteManifest(ctx context.Context, code string) (AppSecrets, error)

// InstallationToken returns a cached token if it remains valid beyond the refresh window; otherwise it refreshes and returns a new token with updated expiry.
func (m *AppManager) InstallationToken(ctx context.Context, installationID int64) (InstallationTokenInfo, error)

// ListDeliveries returns a page of webhook deliveries for the app respecting the limit and cursor, plus the next cursor when present.
func (m *AppManager) ListDeliveries(ctx context.Context, limit int, cursor string) (DeliveryPage, error)

// RedeliverDelivery triggers a redelivery for the given webhook delivery ID and returns the latest delivery details after requeueing.
func (m *AppManager) RedeliverDelivery(ctx context.Context, deliveryID int64) (DeliverySummary, error)

// AppSecrets captures credentials returned after completing the manifest handshake.
type AppSecrets struct {
    Slug          string
    ClientID      string
    ClientSecret  string
    WebhookSecret string
    PrivateKeyPEM string
}

// InstallationTokenInfo captures the token value and expiry timestamp.
type InstallationTokenInfo struct {
    Token     string
    ExpiresAt time.Time
}

// DeliverySummary captures webhook delivery status data.
type DeliverySummary struct {
    ID           int64
    Status       string
    Redelivery   bool
    DeliveredAt  time.Time
    RequestID    string
}

// DeliveryPage bundles delivery entries and pagination cursor.
type DeliveryPage struct {
    Deliveries []DeliverySummary
    NextCursor string
}

Dependencies { .dependencies }

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

Provides authenticated GitHub App manifest completion, installation token creation, and webhook delivery listing/redelivery helpers.

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

tile.json