emcogithub

package
v0.0.0-...-bb2f907 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfFileExists

func CheckIfFileExists(ctx context.Context, c interface{}, userName, repoName, branch, path string) (bool, error)

Function to check if file exists params : context, go git client, User Name, Repo Name, Branch, Path return : LatestCommit string, error

func CreateBranch

func CreateBranch(ctx context.Context, c interface{}, latestCommitSHA, userName, repoName, branch string) error

function to create new branch from main params : context, go git client, latestCommitSHA, User Name, Repo Name, branch return : error

func CreateRepo

func CreateRepo(ctx context.Context, c interface{}, repoName string, userName string, desc string) error

Function to create a new Repo in github params : context, github client, Repository Name, User Name, description return : nil/error

func DeleteBranch

func DeleteBranch(ctx context.Context, c interface{}, userName, repoName, mergeBranch string) error

Function to delete the branch params : context, go git client, User Name, Repo Name, mergeBranch return : LatestCommit string, error

func DeleteRepo

func DeleteRepo(ctx context.Context, c interface{}, userName string, repoName string) error

Function to delete repo params : context, github client , user name, repo name return : nil/error

func GetFiles

func GetFiles(ctx context.Context, c interface{}, userName string, repoName string, branch string, path string) ([]*gitprovider.CommitFile, error)

Function to get files to the github repo params : context, github client, User Name, Repo Name, Branch Name, path) return : []*gitprovider.CommitFile, nil/error

func GetLatestCommitSHA

func GetLatestCommitSHA(ctx context.Context, c interface{}, userName, repoName, branch, path string) (string, error)

Function to obtaion the SHA of latest commit params : context, github client, User Name, Repo Name, Branch, Path return : LatestCommit string, error

Types

type Github

type Github struct {
	Url      string
	Branch   string
	UserName string
	RepoName string
	GitToken string
	Cluster  string
	Client   interface{}
}

func NewGithub

func NewGithub(cluster, url, branch, user, repo, token string) (*Github, error)

func (*Github) AddToCommit

func (p *Github) AddToCommit(path, content string, ref interface{}) interface{}

Function to Add file to the commit params : path , content, files (gitprovider commitfile array) return : files (gitprovider commitfile array)

func (*Github) ClusterWatcher

func (p *Github) ClusterWatcher(ctx context.Context, cid, app, cluster string, waitTime int) error

func (*Github) CommitFiles

func (p *Github) CommitFiles(app, commitMessage string, files interface{}) error

Function to commit multiple files to the github repo params : context, github client, User Name, Repo Name, BranchName, Commit Message, files ([]gitprovider.CommitFile) return : nil/error

func (*Github) CommitStatus

func (p *Github) CommitStatus(commitMessage, branchName, cid, app string, files interface{}) error

Function to commit multiple files to the github repo params : context, Branch Name, Commit Message, appName, files ([]gitprovider.CommitFile) return : nil/error

func (*Github) DeleteClusterStatusCR

func (p *Github) DeleteClusterStatusCR(ctx context.Context, cid, app, cluster string) error

func (*Github) DeleteToCommit

func (p *Github) DeleteToCommit(path string, ref interface{}) interface{}

Function to Delete file from the commit params : path, files (gitprovider commitfile array) return : files (gitprovider commitfile array)

type GithubClient

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

func CreateClient

func CreateClient(userName, githubToken string) (GithubClient, error)

Function to create githubClient params : github token return : github client, error

Jump to

Keyboard shortcuts

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