github

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package github contains logic relating to the management of github repos

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPrivateRepoForbidden is returned when creation fails due to an
	// attempt to register a private repo in a project which does not allow
	// private repos
	ErrPrivateRepoForbidden = errors.New("private repos cannot be registered in this project")
)

Functions

This section is empty.

Types

type RepositoryService

type RepositoryService interface {
	// CreateRepository registers a GitHub repository, including creating
	// a webhook in the repo in GitHub.
	CreateRepository(
		ctx context.Context,
		client ghclient.GitHubRepoClient,
		provider *db.Provider,
		projectID uuid.UUID,
		repoName string,
		repoOwner string,
	) (*pb.Repository, error)
	// DeleteRepository removes the webhook and deletes the repo from the database.
	DeleteRepository(
		ctx context.Context,
		client ghclient.GitHubRepoClient,
		repo *db.Repository,
	) error
	// GetRepositoryById retrieves a repository by its ID and project.
	GetRepositoryById(ctx context.Context, repositoryID uuid.UUID, projectID uuid.UUID) (db.Repository, error)
	// GetRepositoryByName retrieves a repository by its name, owner, project and provider (if specified).
	GetRepositoryByName(
		ctx context.Context,
		repoOwner string,
		repoName string,
		projectID uuid.UUID,
		providerName string,
	) (db.Repository, error)
	// DeleteRepositoriesByProvider cleans up the state (e.g. webhooks) for repositories associated with this provider
	DeleteRepositoriesByProvider(
		ctx context.Context,
		client ghclient.GitHubRepoClient,
		providerName string,
		projectID uuid.UUID,
	) error
}

RepositoryService encapsulates logic related to registering and deleting repos TODO: get rid of the github client from this interface

func NewRepositoryService

func NewRepositoryService(
	webhookManager webhooks.WebhookManager,
	store db.Store,
	eventProducer events.Publisher,
) RepositoryService

NewRepositoryService creates an instance of the RepositoryService interface

Directories

Path Synopsis
Package clients defines the shared client interface used by github repo management code
Package clients defines the shared client interface used by github repo management code
mock
Package mockghclients is a generated GoMock package.
Package mockghclients is a generated GoMock package.
Package fixtures contains fixtures used within the github repositories package.
Package fixtures contains fixtures used within the github repositories package.
Package mockghrepo is a generated GoMock package.
Package mockghrepo is a generated GoMock package.
Package webhooks contains logic relating to manipulating GitHub webhooks
Package webhooks contains logic relating to manipulating GitHub webhooks
mock
Package mockghhook is a generated GoMock package.
Package mockghhook is a generated GoMock package.

Jump to

Keyboard shortcuts

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