githubreconciler

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOrgTokenSource added in v0.7.5

func NewOrgTokenSource(ctx context.Context, identity, org string) oauth2.TokenSource

NewOrgTokenSource creates a new token source for org-scoped GitHub credentials

func NewRepoTokenSource added in v0.7.5

func NewRepoTokenSource(ctx context.Context, identity, org, repo string) oauth2.TokenSource

NewRepoTokenSource creates a new token source for repo-scoped GitHub credentials

Types

type ClientCache

type ClientCache struct {
	// contains filtered or unexported fields
}

ClientCache manages GitHub clients for multiple org/repo combinations.

func NewClientCache

func NewClientCache(tokenSourceFunc TokenSourceFunc) *ClientCache

NewClientCache creates a new client cache with the provided token source function.

func (*ClientCache) Clear

func (cc *ClientCache) Clear()

Clear removes all cached clients.

func (*ClientCache) Get

func (cc *ClientCache) Get(ctx context.Context, org, repo string) (*github.Client, error)

Get returns a GitHub client for the given org/repo, creating one if needed.

type Option

type Option func(*Reconciler)

Option configures a Reconciler.

func WithOrgScopedCredentials added in v0.7.0

func WithOrgScopedCredentials() Option

WithOrgScopedCredentials configures the reconciler to use org-scoped credentials instead of repo-scoped credentials. When enabled, the same GitHub client will be used for all repositories within an organization.

func WithReconciler

func WithReconciler(f ReconcilerFunc) Option

WithReconciler sets the reconciler function for all resource types.

type Reconciler

type Reconciler struct {
	workqueue.UnimplementedWorkqueueServiceServer
	// contains filtered or unexported fields
}

Reconciler manages the reconciliation of GitHub resources.

func NewReconciler

func NewReconciler(cc *ClientCache, opts ...Option) *Reconciler

NewReconciler creates a new Reconciler with the given options.

func (*Reconciler) Process added in v0.6.196

Process implements the WorkqueueService.Process RPC.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, url string) error

Reconcile processes the given resource URL.

type ReconcilerFunc

type ReconcilerFunc func(ctx context.Context, res *Resource, gh *github.Client) error

ReconcilerFunc is the function signature for GitHub resource reconcilers. It receives the parsed resource information and appropriate GitHub client, and returns an error if reconciliation fails.

type Resource

type Resource struct {
	// Owner is the GitHub organization or user.
	Owner string

	// Repo is the repository name.
	Repo string

	// Number is the issue or pull request number.
	// Only set for ResourceTypeIssue and ResourceTypePullRequest.
	Number int

	// Type indicates the resource type.
	Type ResourceType

	// URL is the original URL that was parsed.
	URL string

	// Ref is the branch, tag, or commit SHA.
	// Only set for ResourceTypePath.
	Ref string

	// Path is the file or directory path.
	// Only set for ResourceTypePath.
	Path string
}

Resource represents a parsed GitHub resource (issue, pull request, or path).

func (*Resource) String

func (r *Resource) String() string

String returns the string representation of the resource.

type ResourceType

type ResourceType string

ResourceType represents the type of GitHub resource.

const (
	// ResourceTypeIssue represents a GitHub issue.
	ResourceTypeIssue ResourceType = "issue"

	// ResourceTypePullRequest represents a GitHub pull request.
	ResourceTypePullRequest ResourceType = "pull_request"

	// ResourceTypePath represents a file or directory path in a repository.
	ResourceTypePath ResourceType = "path"
)

type TokenSourceFunc

type TokenSourceFunc func(ctx context.Context, org, repo string) (oauth2.TokenSource, error)

TokenSourceFunc is a function that creates an OAuth2 token source for a given org/repo.

Directories

Path Synopsis
Package statusmanager provides Kubernetes-style status management for GitHub reconcilers using GitHub Check Runs API.
Package statusmanager provides Kubernetes-style status management for GitHub reconcilers using GitHub Check Runs API.

Jump to

Keyboard shortcuts

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