github

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateFileURL

func GenerateFileURL(repoURL, filePath string, lineNumber int) string

GenerateFileURL creates a GitHub URL pointing to a specific line in a file

func GenerateFileURLWithBranch

func GenerateFileURLWithBranch(repoURL, filePath string, lineNumber int, branch string) string

GenerateFileURLWithBranch creates a GitHub URL using an explicit branch name (no SHA).

func IsGitHubRepository

func IsGitHubRepository(repoURL string) bool

IsGitHubRepository checks if a repository URL is a GitHub repository

func IsRateLimitError

func IsRateLimitError(err error) bool

IsRateLimitError reports whether err (or any error in its chain) is a GitHub primary or secondary (abuse) rate limit error. Uses errors.As so it works correctly with wrapped errors.

func ParseRepositoryURL

func ParseRepositoryURL(repoURL string) (owner, repo string, err error)

ParseRepositoryURL parses a GitHub repository URL

Types

type Client

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

Client represents a GitHub API client

func NewClient

func NewClient() *Client

NewClient creates a new GitHub API client

func NewClientWithSmartAuth

func NewClientWithSmartAuth(providedToken string) (*Client, string)

NewClientWithSmartAuth creates a GitHub client with intelligent authentication

func NewClientWithToken

func NewClientWithToken(token string) *Client

NewClientWithToken creates a new GitHub API client with the provided token

func (*Client) CloneRepository

func (c *Client) CloneRepository(repoURL, destDir string) (string, error)

CloneRepository clones a GitHub repository to a local directory

func (*Client) CloneRepositoryWithBranch

func (c *Client) CloneRepositoryWithBranch(repoURL, destDir, branch string) (string, error)

CloneRepositoryWithBranch clones a specific branch of a GitHub repository

func (*Client) CloneRepositoryWithProgress

func (c *Client) CloneRepositoryWithProgress(repoURL, destDir string, showProgress bool, progressCallback func(progress int, stage string)) (string, error)

CloneRepositoryWithProgress clones a GitHub repository with optional progress reporting

func (*Client) CloneRepositoryWithProgressAndBranch

func (c *Client) CloneRepositoryWithProgressAndBranch(repoURL, destDir, branch string, showProgress bool, progressCallback func(progress int, stage string)) (string, error)

CloneRepositoryWithProgressAndBranch clones a GitHub repository with optional progress reporting and branch selection

func (*Client) CreateCheckRun

func (c *Client) CreateCheckRun(owner, repo, sha string, findings []string) error

CreateCheckRun creates a GitHub check run for a commit

func (*Client) CreateIssueComment

func (c *Client) CreateIssueComment(owner, repo string, number int, body string) error

CreateIssueComment creates a comment on a GitHub issue or pull request

func (*Client) DiscoverOrganizationRepositories

func (c *Client) DiscoverOrganizationRepositories(orgName string, filter interface{}) ([]RepositoryInfo, error)

DiscoverOrganizationRepositories discovers all repositories in a GitHub organization

func (*Client) DownloadWorkflowFiles

func (c *Client) DownloadWorkflowFiles(owner, repo, destDir, ref string) ([]string, error)

DownloadWorkflowFiles downloads workflow files to a local directory

func (*Client) GetDefaultBranch

func (c *Client) GetDefaultBranch(owner, repo string) (string, error)

GetDefaultBranch gets the default branch name for a repository

func (*Client) GetLatestRelease

func (c *Client) GetLatestRelease(owner, repo string) (string, time.Time, error)

GetLatestRelease fetches the latest release tag for a GitHub Action (owner/repo)

func (*Client) GetWorkflowFiles

func (c *Client) GetWorkflowFiles(owner, repo, ref string) ([]*github.RepositoryContent, error)

func (*Client) GetWorkflowFilesContents

func (c *Client) GetWorkflowFilesContents(owner, repo, ref string) (map[string][]byte, error)

GetWorkflowFilesContents fetches all workflow files from a repository using the GitHub API.

type RepositoryFilter

type RepositoryFilter struct {
	IncludeForks    bool   // Include forked repositories
	IncludeArchived bool   // Include archived repositories
	IncludePrivate  bool   // Include private repositories
	IncludePublic   bool   // Include public repositories
	MaxRepos        int    // Maximum number of repositories to analyze (0 = no limit)
	NameFilter      string // Regular expression to filter repository names
}

RepositoryFilter defines criteria for filtering repositories during organization analysis

type RepositoryInfo

type RepositoryInfo struct {
	Name          string `json:"name"`
	FullName      string `json:"full_name"`
	URL           string `json:"url"`
	CloneURL      string `json:"clone_url"`
	DefaultBranch string `json:"default_branch,omitempty"`
	IsPrivate     bool   `json:"is_private"`
	IsFork        bool   `json:"is_fork"`
	IsArchived    bool   `json:"is_archived"`
	Language      string `json:"language,omitempty"`
	Description   string `json:"description,omitempty"`
	UpdatedAt     string `json:"updated_at,omitempty"`
}

RepositoryInfo represents basic information about a repository

Jump to

Keyboard shortcuts

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