github

package
v0.0.0-...-ec66445 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetAppInstallationsForRepository func(githubAppIdStr string, appPrivateKeyPem []byte, repoUrl string) (*ApplicationInstallation, string, error) = getAppInstallationsForRepository
View Source
var NewGithubClient func(accessToken string) *GithubClient = newGithubClient

Allow mocking for tests

View Source
var NewGithubClientByApp func(appId int64, privateKeyPem []byte, repoUrl string) (*GithubClient, error) = newGithubClientByApp

Allow mocking for tests

View Source
var NewGithubClientWithBasicAuth func(username, password string) *GithubClient = newGithubClientWithBasicAuth

Functions

func CheckGitUrlError

func CheckGitUrlError(err error) error

CheckGitUrlError returns more specific git error

Types

type ApplicationInstallation

type ApplicationInstallation struct {
	Token        string
	ID           int64
	Repositories []*github.Repository
}

type GithubClient

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

func (*GithubClient) DeleteBranch

func (g *GithubClient) DeleteBranch(repoUrl, branchName string) (bool, error)

DeleteBranch deletes given branch from repository

func (*GithubClient) DeletePaCWebhook

func (g *GithubClient) DeletePaCWebhook(repoUrl, webhookUrl string) error

DeletePaCWebhook deletes Pipelines as Code webhook in the given repository

func (*GithubClient) DownloadFileContent

func (g *GithubClient) DownloadFileContent(repoUrl, branchName, filePath string) ([]byte, error)

func (*GithubClient) EnsurePaCMergeRequest

func (g *GithubClient) EnsurePaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (webUrl string, err error)

EnsurePaCMergeRequest creates or updates existing Pipelines as Code configuration proposal merge request

func (*GithubClient) FindUnmergedPaCMergeRequest

func (g *GithubClient) FindUnmergedPaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (*gp.MergeRequest, error)

FindUnmergedPaCMergeRequest finds out the unmerged merge request that is opened during the component onboarding An onboarding merge request fulfills both: 1) opened based on the base branch which is determined by the Revision or is the default branch of component repository 2) opened from head ref: owner:appstudio-{component.Name} If no onboarding merge request is found, nil is returned.

func (*GithubClient) GetAppUserId

func (g *GithubClient) GetAppUserId(userName string) (int64, error)

GetAppUserId get info about application user

func (*GithubClient) GetBranchSha

func (g *GithubClient) GetBranchSha(repoUrl, branchName string) (string, error)

GetBranchSha returns SHA of top commit in the given branch If branch name is empty, default branch is used.

func (g *GithubClient) GetBrowseRepositoryAtShaLink(repoUrl, sha string) string

func (*GithubClient) GetConfiguredGitAppName

func (g *GithubClient) GetConfiguredGitAppName() (string, string, error)

GetConfiguredGitAppName returns name and slug of GitHub App that created client token.

func (*GithubClient) GetDefaultBranchWithChecks

func (g *GithubClient) GetDefaultBranchWithChecks(repoUrl string) (string, error)

GetDefaultBranchWithChecks returns name of default branch in the given repository also performs additional checks if repo exists and hostname is valid and returns more specific error

func (*GithubClient) IsFileExist

func (g *GithubClient) IsFileExist(repoUrl, branchName, filePath string) (bool, error)

IsFileExist check whether given file exists in the given branch of the reposiotry. If branch is empty string, default branch is used.

func (*GithubClient) IsRepositoryPublic

func (g *GithubClient) IsRepositoryPublic(repoUrl string) (bool, error)

IsRepositoryPublic returns true if the repository could be accessed without authentication

func (*GithubClient) SetupPaCWebhook

func (g *GithubClient) SetupPaCWebhook(repoUrl, webhookUrl, webhookSecret string) error

SetupPaCWebhook creates Pipelines as Code webhook in the given repository

func (*GithubClient) UndoPaCMergeRequest

func (g *GithubClient) UndoPaCMergeRequest(repoUrl string, d *gp.MergeRequestData) (webUrl string, err error)

UndoPaCMergeRequest creates or updates existing Pipelines as Code configuration removal merge request

Jump to

Keyboard shortcuts

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