github

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultPermissions

type DefaultPermissions struct {
	Contents     string `json:"contents"`
	Issues       string `json:"issues"`
	Metadata     string `json:"metadata"`
	PullRequests string `json:"pull_requests"`
	Members      string `json:"members,omitempty"`
}

DefaultPermissions contains permission settings

type GitHubAppManifest

type GitHubAppManifest struct {
	Name               string             `json:"name"`
	Description        string             `json:"description"`
	URL                string             `json:"url"`
	HookAttributes     HookAttributes     `json:"hook_attributes"`
	RedirectURL        string             `json:"redirect_url"`
	SetupUrl           string             `json:"setup_url"`
	Public             bool               `json:"public"`
	DefaultPermissions DefaultPermissions `json:"default_permissions"`
	DefaultEvents      []string           `json:"default_events"`
}

GitHubAppManifest represents the structure for GitHub App manifest

type GithubBranch

type GithubBranch struct {
	Name      string `json:"name"`
	Ref       string `json:"ref"`
	Protected bool   `json:"protected"`
	SHA       string `json:"sha"`
}

GithubBranch contains information about a branch

type GithubClient

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

func NewGithubClient

func NewGithubClient(githubURL string, cfg *config.Config) *GithubClient

func (*GithubClient) ClonePublicRepository

func (self *GithubClient) ClonePublicRepository(ctx context.Context, repoURL string, refName string, commitSHA string) (string, error)

ClonePublicRepository clones a public repository without authentication

func (*GithubClient) CloneRepository

func (self *GithubClient) CloneRepository(ctx context.Context, appID, installationID int64, appPrivateKey string, repoURL string, refName string, commitSHA string) (string, error)

CloneRepository clones a repository with optional authentication

func (*GithubClient) CreateAppManifest

func (self *GithubClient) CreateAppManifest(redirectUrl string, setupUrl string, forOrganization bool) (manifest *GitHubAppManifest, appName string, err error)

CreateAppManifest generates the GitHub App manifest

func (*GithubClient) GetAuthenticatedClient

func (self *GithubClient) GetAuthenticatedClient(ctx context.Context, appID int64, installationID int64, appPrivateKey string) (*github.Client, error)

func (*GithubClient) GetCommitSummary

func (self *GithubClient) GetCommitSummary(ctx context.Context, installation *ent.GithubInstallation, owner, repo string, branchOrSHA string, isCommitSHA bool) (commitSHA, commitMessage string, committer *schema.GitCommitter, err error)

Get branch head summary - sha, message, author GetCommitSummary - get summary for a specific commit or branch head

func (*GithubClient) GetInstallationToken

func (self *GithubClient) GetInstallationToken(ctx context.Context, appID int64, installationID int64, appPrivateKey string) (string, error)

Get the token we can use to authenticate with GitHub

func (*GithubClient) GetRepositoryDetail

func (self *GithubClient) GetRepositoryDetail(ctx context.Context, installation *ent.GithubInstallation, owner, repo string) (*GithubRepositoryDetail, error)

Get details for a repository

func (*GithubClient) ManifestCodeConversion

func (self *GithubClient) ManifestCodeConversion(ctx context.Context, code string) (*github.AppConfig, error)

ManifestCodeConversion gets app configruation from github using the code

func (*GithubClient) ReadUserAdminOrganizations

func (self *GithubClient) ReadUserAdminOrganizations(ctx context.Context, installation *ent.GithubInstallation) ([]*github.Organization, error)

func (*GithubClient) ReadUserAdminRepositories

func (self *GithubClient) ReadUserAdminRepositories(ctx context.Context, installations []*ent.GithubInstallation) ([]*GithubRepository, error)

Read user's admin repositories (that they can configure CI/CD on)

func (*GithubClient) VerifyRepositoryAccess

func (self *GithubClient) VerifyRepositoryAccess(ctx context.Context, installation *ent.GithubInstallation, owner, repo string) (canAccess bool, repoUrl, defaultBranch string, err error)

VerifyRepositoryAccess with resource cleanup

type GithubRepository

type GithubRepository struct {
	ID             int64                 `json:"id"`
	InstallationID int64                 `json:"installation_id"`
	Name           string                `json:"name"`
	FullName       string                `json:"full_name"`
	HTMLURL        string                `json:"html_url"`
	CloneURL       string                `json:"clone_url"`
	HomePage       string                `json:"homepage"`
	Owner          GithubRepositoryOwner `json:"owner"`
	UpdatedAt      time.Time             `json:"updated_at"`
}

type GithubRepositoryDetail

type GithubRepositoryDetail struct {
	ID              int64                  `json:"id"`
	InstallationID  int64                  `json:"installationId"`
	Name            string                 `json:"name"`
	FullName        string                 `json:"fullName"`
	Description     string                 `json:"description"`
	URL             string                 `json:"url"`
	HTMLURL         string                 `json:"htmlUrl"`
	DefaultBranch   string                 `json:"defaultBranch"`
	Language        string                 `json:"language"`
	Private         bool                   `json:"private"`
	Fork            bool                   `json:"fork"`
	Archived        bool                   `json:"archived"`
	Disabled        bool                   `json:"disabled"`
	Size            int                    `json:"size"`
	StargazersCount int                    `json:"stargazersCount"`
	WatchersCount   int                    `json:"watchersCount"`
	ForksCount      int                    `json:"forksCount"`
	OpenIssuesCount int                    `json:"openIssuesCount"`
	CreatedAt       time.Time              `json:"createdAt"`
	UpdatedAt       time.Time              `json:"updatedAt"`
	PushedAt        time.Time              `json:"pushedAt"`
	Branches        []*GithubBranch        `json:"branches"`
	Tags            []*GithubTag           `json:"tags"`
	Owner           *GithubRepositoryOwner `json:"owner"`
}

! Getting repository details GithubRepositoryDetail contains detailed information about a repository

type GithubRepositoryOwner

type GithubRepositoryOwner struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	Login     string `json:"login"`
	AvatarURL string `json:"avatar_url"`
}

* Formatting

type GithubTag

type GithubTag struct {
	Name string `json:"name"`
	Ref  string `json:"ref"`
	SHA  string `json:"sha"`
}

GithubTag contains information about a tag

type HookAttributes

type HookAttributes struct {
	URL string `json:"url"`
}

HookAttributes contains webhook configuration

Jump to

Keyboard shortcuts

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