github

package
v0.0.0-...-78730a9 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractOwnerAndRepo

func ExtractOwnerAndRepo(repoURL string) (string, string, error)

ExtractOwnerAndRepo extracts the owner and repo from a repository URL

func HasTargetLabel

func HasTargetLabel(labels []*github.Label, targetLabel string) bool

IsLabelAttached checks if a specific label is attached to the PR

func IsNotFound

func IsNotFound(err error) bool

IsNotFound checks if an error is a 404 Not Found error

Types

type Client

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

Client wraps the GitHub API client

func NewClient

func NewClient(cfg *config.Config) (*Client, error)

NewClient creates a new GitHub client

func (*Client) CheckRateLimit

func (c *Client) CheckRateLimit(ctx context.Context)

CheckRateLimit logs the current rate limit status

func (*Client) CompareCommits

func (c *Client) CompareCommits(ctx context.Context, owner, repo, base, head string) ([]*github.CommitFile, []*github.RepositoryCommit, error)

CompareCommits compares two commits and returns the files that changed

func (*Client) CreatePRComment

func (c *Client) CreatePRComment(ctx context.Context, owner, repo string, number int, body string) error

CreatePRComment creates a comment on a pull request

func (*Client) CreateReview

func (c *Client) CreateReview(ctx context.Context, owner, repo string, number int, commitID string, comments []*github.DraftReviewComment, body string) error

CreateReview creates a review on a pull request

func (*Client) GetPullRequestLabels

func (c *Client) GetPullRequestLabels(ctx context.Context, owner, repo string, number int) ([]*github.Label, error)

GetPullRequestLabels gets the labels of a pull request

func (*Client) GetRepoVariable

func (c *Client) GetRepoVariable(ctx context.Context, owner, repo, name string) (string, error)

GetRepoVariable gets a repository variable

type EventHandler

type EventHandler func(payload interface{}) error

EventHandler is a function that handles a specific GitHub event

type WebhookHandler

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

WebhookHandler handles GitHub webhook events

func NewWebhookHandler

func NewWebhookHandler(secret string) *WebhookHandler

NewWebhookHandler creates a new webhook handler

func (*WebhookHandler) HandleWebhook

func (h *WebhookHandler) HandleWebhook(w http.ResponseWriter, r *http.Request)

HandleWebhook handles incoming webhook requests

func (*WebhookHandler) On

func (h *WebhookHandler) On(event string, handler EventHandler)

On registers a handler for a specific event

Jump to

Keyboard shortcuts

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