github

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package github provides GitHub API client for PR integration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the GitHub API client

func NewClient

func NewClient(token, repository string) *Client

NewClient creates a new GitHub API client

func NewClientFromEnv

func NewClientFromEnv() *Client

NewClientFromEnv creates a client from GitHub Actions environment variables

func (*Client) CreateIssueComment

func (c *Client) CreateIssueComment(ctx context.Context, prNumber int, body string) (*gh.IssueComment, error)

CreateIssueComment creates a new comment on an issue/PR

func (*Client) HasToken

func (c *Client) HasToken() bool

HasToken returns true if a token is configured

func (*Client) ListIssueComments

func (c *Client) ListIssueComments(ctx context.Context, prNumber int) ([]*gh.IssueComment, error)

ListIssueComments lists all comments on an issue/PR

func (*Client) UpdateIssueComment

func (c *Client) UpdateIssueComment(ctx context.Context, commentID int64, body string) (*gh.IssueComment, error)

UpdateIssueComment updates an existing comment

type PRContext

type PRContext struct {
	Owner        string
	Repo         string
	PRNumber     int
	SourceBranch string
	TargetBranch string
	RunID        string
	CommitSHA    string
	InPR         bool
}

PRContext contains information about the current PR context

func DetectPRContext

func DetectPRContext() *PRContext

DetectPRContext detects if we're running in a GitHub Actions PR workflow

type PRService

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

PRService handles GitHub PR comment operations

func NewPRService

func NewPRService(cfg *config.PRConfig, client *Client, ctx *PRContext) *PRService

NewPRService creates a new PR service with injected dependencies.

func NewPRServiceFromEnv added in v0.6.5

func NewPRServiceFromEnv(cfg *config.PRConfig) *PRService

NewPRServiceFromEnv creates a new PR service with dependencies from environment.

func (*PRService) IsEnabled

func (s *PRService) IsEnabled() bool

IsEnabled returns true if PR integration is enabled

func (*PRService) UpsertComment

func (s *PRService) UpsertComment(plans []ci.ModulePlan, policySummary *ci.PolicySummary) error

UpsertComment creates or updates the terraci comment on the PR

Jump to

Keyboard shortcuts

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