Documentation
¶
Overview ¶
internal/github/client.go
Index ¶
- Constants
- func ParseGitHubRemote(remoteURL string) (owner, repo string, err error)
- type Client
- func (c *Client) AddIssueToProject(ctx context.Context, projectID string, issueID string) error
- func (c *Client) CreateRepo(ctx context.Context, owner, name, description string, isPrivate bool) (*github.Repository, error)
- func (c *Client) GetAuthenticatedUserLogin(ctx context.Context) (string, error)
- func (c *Client) GetProjectByNumber(ctx context.Context, number int) (*ProjectWithID, error)
- func (c *Client) ListProjects(ctx context.Context) ([]Project, error)
- func (c *Client) UpdateBranchProtection(ctx context.Context, branch string, request github.ProtectionRequest) error
- type Project
- type ProjectWithID
Constants ¶
const GHTokenEnvVar = "GITHUB_TOKEN"
gosec:G101
Variables ¶
This section is empty.
Functions ¶
func ParseGitHubRemote ¶
ParseGitHubRemote extracts the owner and repository name from a GitHub remote URL.
Types ¶
type Client ¶
type Client struct {
*github.Client
GraphQL *githubv4.Client
// contains filtered or unexported fields
}
Client wraps the go-github clients for both REST and GraphQL APIs.
func NewClient ¶
NewClient creates a new GitHub client, authenticating using the GITHUB_TOKEN environment variable.
func (*Client) AddIssueToProject ¶
AddIssueToProject adds an issue (by its GraphQL Node ID) to a project (by its GraphQL Node ID).
func (*Client) CreateRepo ¶
func (c *Client) CreateRepo( ctx context.Context, owner, name, description string, isPrivate bool, ) (*github.Repository, error)
CreateRepo creates a new repository on GitHub for a specific owner (user or org).
func (*Client) GetAuthenticatedUserLogin ¶
GetAuthenticatedUserLogin returns the login name of the user authenticated by the token.
func (*Client) GetProjectByNumber ¶
GetProjectByNumber fetches a single project by its number to get its GraphQL Node ID.
func (*Client) ListProjects ¶
ListProjects fetches the first 100 GitHub Projects (V2) for the repository's owner.
func (*Client) UpdateBranchProtection ¶
func (c *Client) UpdateBranchProtection( ctx context.Context, branch string, request github.ProtectionRequest, ) error
UpdateBranchProtection applies a set of protection rules to the client's configured branch.