github

package
v0.107.8 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright (C) 2021-2023, Kubefirst

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyTokenPermissions

func VerifyTokenPermissions(githubToken string) error

VerifyTokenPermissions compares scope of the provided token to the required scopes for kubefirst functionality

Types

type Session

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

func New

func New(token string) Session

New - Create a new client for github wrapper

func (Session) AddSSHKey

func (g Session) AddSSHKey(keyTitle, publicKey string) (*github.Key, error)

AddSSHKey - Add ssh keys to a user account to allow kubefirst installer to use its own token during installation

func (Session) CheckRepoExists

func (g Session) CheckRepoExists(owner, name string) int

GetRepo - Always returns a status code for whether a repository exists or not

func (Session) CheckTeamExists

func (g Session) CheckTeamExists(owner, name string) int

GetRepo - Always returns a status code for whether a team exists or not

func (Session) CommentPR

func (g Session) CommentPR(pullRequesrt *github.PullRequest, gitHubUser, body string) error

func (Session) CreatePR

func (g Session) CreatePR(
	branchName string,
	repoName string,
	gitHubUser string,
	baseBranch string,
	title string,
	body string,
) (*github.PullRequest, error)

func (Session) CreatePrivateRepo

func (g Session) CreatePrivateRepo(org, name, description string) error

CreatePrivateRepo - Use github API to create a private repo

func (Session) CreateWebhookRepo

func (g Session) CreateWebhookRepo(org, repo, hookName, hookURL, hookSecret string, hookEvents []string) error

func (Session) DeleteRepositoryWebhook

func (g Session) DeleteRepositoryWebhook(owner, repository, url string) error

DeleteRepositoryWebhook

func (Session) GetRepo

func (g Session) GetRepo(owner, name string) (*github.Repository, error)

GetRepo - Returns a repo

func (Session) ListRepoWebhooks

func (g Session) ListRepoWebhooks(owner, repo string) ([]*github.Hook, error)

ListRepoWebhooks returns all webhooks for a repository

func (Session) RemoveRepo

func (g Session) RemoveRepo(owner, name string) (*github.Response, error)

RemoveRepo Removes a repository based on repository owner and name. It returns github.Response that hold http data, as http status code, the caller can make use of the http status code to validate the response.

func (Session) RemoveSSHKey

func (g Session) RemoveSSHKey(keyID int64) error

RemoveSSHKey - Removes SSH Key from github user

func (Session) RemoveSSHKeyByPublicKey

func (g Session) RemoveSSHKeyByPublicKey(user, publicKey string) error

RemoveSSHKeyByPublicKey deletes a GitHub key that matches the provided public key.

func (Session) RemoveTeam

func (g Session) RemoveTeam(owner, team string) error

RemoveTeam - Remove a team

func (Session) RetrySearchPullRequestComment

func (g Session) RetrySearchPullRequestComment(
	gitHubUser string,
	gitOpsRepo string,
	pullRequest *github.PullRequest,
	searchFor string,
	logMessage string,
) (bool, error)

func (Session) SearchWordInPullRequestComment

func (g Session) SearchWordInPullRequestComment(gitHubUser string,
	gitOpsRepo string,
	pullRequest *github.PullRequest,
	searchFor string,
) (bool, error)

SearchWordInPullRequestComment look for a specific sentence in a GitHub Pull Request comment

Jump to

Keyboard shortcuts

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