Documentation
¶
Overview ¶
Package github provides GitHub API interactions.
Index ¶
- Variables
- type Client
- func (c *Client) CreateRelease(ctx context.Context, owner, repo string, opts CreateReleaseOptions) (*Release, error)
- func (c *Client) FindPRComment(ctx context.Context, owner, repo string, prNumber int, marker string) (bool, error)
- func (c *Client) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*Release, error)
- func (c *Client) ListPRsForCommit(ctx context.Context, owner, repo, sha string) ([]PR, error)
- func (c *Client) PostPRComment(ctx context.Context, owner, repo string, prNumber int, body string) error
- func (c *Client) SearchPRsForCommit(ctx context.Context, query string) ([]PR, error)
- type CreateReleaseOptions
- type PR
- type Release
Constants ¶
This section is empty.
Variables ¶
var ( ErrForbidden = errors.New("forbidden: GITHUB_TOKEN lacks required permissions") ErrNotFound = errors.New("not found: resource does not exist") ErrUnprocessable = errors.New("unprocessable: GitHub API rejected request") ErrRateLimited = errors.New("rate limited: GitHub API rate limit exceeded") ErrServerError = errors.New("server error: GitHub API returned 5xx") )
Typed errors for GitHub API responses.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the go-github client.
func NewClient ¶
NewClient constructs a GitHub API client. baseURL is the value of GITHUB_API_URL (may be empty or without trailing slash). For the default GitHub.com API URL, the standard client is returned. For any other non-empty URL (GHES), WithEnterpriseURLs is used. A trailing slash is added automatically — go-github v60 requires it.
func (*Client) CreateRelease ¶
func (c *Client) CreateRelease(ctx context.Context, owner, repo string, opts CreateReleaseOptions) (*Release, error)
CreateRelease creates a new GitHub release. On HTTP 422 with errors[].code == "already_exists", calls GetReleaseByTag and returns that result. Returns (Release, nil) on success, typed errors on other failures.
func (*Client) FindPRComment ¶
func (c *Client) FindPRComment(ctx context.Context, owner, repo string, prNumber int, marker string) (bool, error)
FindPRComment searches for an existing comment on a PR by marker string. marker: substring to search for in comment body (e.g., "<!-- semrel-notify:v1.4.0 -->") Returns (true, nil) if found, (false, nil) if not found, (false, error) on API failure.
func (*Client) GetReleaseByTag ¶
GetReleaseByTag retrieves a release by tag name. Returns (Release, nil) on 200, typed errors on other status codes.
func (*Client) ListPRsForCommit ¶
ListPRsForCommit retrieves all PRs associated with a commit SHA. Calls GET /repos/{owner}/{repo}/commits/{sha}/pulls Returns ([]PR, nil) on success, typed errors on failure.
type CreateReleaseOptions ¶
CreateReleaseOptions for CreateRelease.