Documentation
¶
Overview ¶
Package prdiff provides utilities for interacting with GitHub pull requests, including resolving the merge-base commit SHA via the GitHub API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseOwnerRepo ¶
ParseOwnerRepo extracts the owner and repository name from a GitHub remote URL or a plain "owner/repo" string. It handles the following forms:
owner/repo https://github.com/owner/repo https://github.com/owner/repo.git git@github.com:owner/repo.git ssh://git@github.com/owner/repo.git
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client retrieves the merge-base commit SHA of a GitHub pull request.
func NewClient ¶
NewClient initializes a GitHub API client. Pass an empty token for unauthenticated access (60 req/hour limit applies). Pass a non-empty baseURL to target a GitHub Enterprise instance instead of github.com.
func (*Client) GetMergeBase ¶
GetMergeBase returns the merge-base commit SHA between the base branch and the head commit of the given pull request number.
func (*Client) GetPRForBranch ¶
GetPRForBranch returns the number of the open pull request whose head branch matches branch in the given repository. It uses the GitHub API to list open PRs filtered by head, matching the behavior of "gh pr view" with no number. Returns an error if no open PR is found for the branch.