github

package
v0.0.0-...-77c6198 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildURI

func BuildURI(owner, repoName string) string

BuildURI constrói uma URI do GitHub a partir dos componentes

Types

type GithubClient

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

func NewClient

func NewClient(ctx context.Context, cfg config.Config) (*GithubClient, error)

func (*GithubClient) BranchStatus

func (g *GithubClient) BranchStatus(ctx context.Context, owner, repo string, sourceBranch, targetBranch string) (*scm.GitBranchStats, error)

func (*GithubClient) Comment

func (g *GithubClient) Comment(ctx context.Context, owner, repo string, number int, body string) error

Comment creates a new PR comment. Always posts a new comment, no deduplication.

func (*GithubClient) CommentUpdate

func (g *GithubClient) CommentUpdate(ctx context.Context, owner, repo string, number int, key, body string) error

CommentUpdate upserts a PR comment identified by key. If a previous comment with the same key exists it is updated; otherwise a new one is created.

func (*GithubClient) FetchRepositoryMetadata

func (g *GithubClient) FetchRepositoryMetadata(ctx context.Context, identifier string) (*model.RepositoryMetadata, error)

FetchRepositoryMetadata busca metadados completos do repositório do GitHub Aceita URI (https://github.com/owner/repo) ou ID numérico

func (*GithubClient) GetPullRequest

func (g *GithubClient) GetPullRequest(ctx context.Context, owner, repo string, number int) (*scm.PullRequest, error)

func (*GithubClient) MergePR

func (g *GithubClient) MergePR(ctx context.Context, owner, repo string, number int, headSHA string) error

func (*GithubClient) ParseWebhook

func (g *GithubClient) ParseWebhook(r *http.Request) (*scm.WebhookEvent, error)

ParseWebhook valida a assinatura HMAC e converte para o modelo de domínio

func (*GithubClient) SetStatus

func (g *GithubClient) SetStatus(ctx context.Context, owner, repo, sha string, state string, description string, targetURL string) error

type URIComponents

type URIComponents struct {
	Owner    string // Nome do owner (user ou organization)
	RepoName string // Nome do repositório
}

URIComponents contém os componentes extraídos de uma URI do GitHub

func ParseURI

func ParseURI(uri string) (*URIComponents, error)

ParseURI extrai os componentes de uma URI do GitHub Formatos suportados: - https://github.com/owner/repo - https://github.com/owner/repo.git - git@github.com:owner/repo.git

Jump to

Keyboard shortcuts

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