Documentation
¶
Index ¶
- type CIContext
- type CheckRun
- type CreatedRelease
- type DeniedPR
- type DependBot
- type Dependency
- type DependencyContext
- type FailedPR
- type FailedRelease
- type MergeProfile
- type MergeResult
- type MergedPR
- type PRContext
- type PRFilter
- type PolicyAction
- type PolicyContext
- type PolicyDecision
- type PullRequest
- type Release
- type ReleaseCandidate
- type ReleaseRequest
- type ReleaseResult
- type Repo
- type RepoContext
- type RepoFilter
- type RepoRef
- type ReviewResult
- type ScanError
- type ScanResult
- type SkippedPR
- type SkippedRelease
- type Tag
- type UpdateType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CIContext ¶
type CIContext struct {
AllPassed bool `json:"allPassed"`
AnyFailed bool `json:"anyFailed"`
AnyPending bool `json:"anyPending"`
PassedChecks []string `json:"passedChecks"`
FailedChecks []string `json:"failedChecks"`
PendingChecks []string `json:"pendingChecks"`
RequiredPassed bool `json:"requiredPassed"`
}
CIContext contains CI/test status for policy evaluation.
type CheckRun ¶
type CheckRun struct {
Name string `json:"name"`
Status string `json:"status"` // queued, in_progress, completed
Conclusion string `json:"conclusion"` // success, failure, neutral, cancelled, skipped, timed_out, action_required
}
CheckRun represents a CI check run status.
type CreatedRelease ¶
type CreatedRelease struct {
Repo RepoRef `json:"repo"`
Version string `json:"version"`
PreviousVersion string `json:"previousVersion"`
ReleaseURL string `json:"releaseUrl"`
PRsMerged int `json:"prsMerged"`
}
CreatedRelease represents a successfully created release.
type DeniedPR ¶
type DeniedPR struct {
PR PullRequest `json:"pr"`
Reason string `json:"reason"`
}
DeniedPR represents a PR that was denied review approval.
type DependBot ¶
type DependBot string
DependBot identifies the dependency management bot.
func DetectDependBot ¶
DetectDependBot determines which dependency bot created a PR based on author.
type Dependency ¶
type Dependency struct {
Name string `json:"name"`
Ecosystem string `json:"ecosystem"` // go, npm, pip, maven, etc.
FromVersion string `json:"fromVersion"`
ToVersion string `json:"toVersion"`
UpdateType UpdateType `json:"updateType"` // major, minor, patch
}
Dependency represents a dependency update in a PR.
type DependencyContext ¶
type DependencyContext struct {
Name string `json:"name"`
Ecosystem string `json:"ecosystem"`
FromVersion string `json:"fromVersion"`
ToVersion string `json:"toVersion"`
UpdateType string `json:"updateType"`
IsMajor bool `json:"isMajor"`
IsMinor bool `json:"isMinor"`
IsPatch bool `json:"isPatch"`
}
DependencyContext contains dependency update information for policy evaluation.
type FailedPR ¶
type FailedPR struct {
PR PullRequest `json:"pr"`
Error string `json:"error"`
}
FailedPR represents a PR that failed to merge.
type FailedRelease ¶
FailedRelease represents a failed release attempt.
type MergeProfile ¶
type MergeProfile struct {
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
// Timing controls
MinAgeHours int `json:"minAgeHours" yaml:"minAgeHours"`
MaxAgeHours int `json:"maxAgeHours" yaml:"maxAgeHours"`
// Update type controls
AutoMergePatch bool `json:"autoMergePatch" yaml:"autoMergePatch"`
AutoMergeMinor bool `json:"autoMergeMinor" yaml:"autoMergeMinor"`
AutoMergeMajor bool `json:"autoMergeMajor" yaml:"autoMergeMajor"`
// CI requirements
RequireAllChecks bool `json:"requireAllChecks" yaml:"requireAllChecks"`
RequiredChecks []string `json:"requiredChecks,omitempty" yaml:"requiredChecks,omitempty"`
AllowPendingChecks bool `json:"allowPendingChecks" yaml:"allowPendingChecks"`
// Merge settings
MergeStrategy string `json:"mergeStrategy" yaml:"mergeStrategy"` // merge, squash, rebase
DeleteBranch bool `json:"deleteBranch" yaml:"deleteBranch"`
// Safety
RequireApproval bool `json:"requireApproval" yaml:"requireApproval"`
MaxPRsPerRun int `json:"maxPRsPerRun" yaml:"maxPRsPerRun"`
}
MergeProfile defines a set of merge policies and behaviors.
type MergeResult ¶
type MergeResult struct {
Timestamp time.Time `json:"timestamp"`
DryRun bool `json:"dryRun"`
Merged []MergedPR `json:"merged,omitempty"`
Skipped []SkippedPR `json:"skipped,omitempty"`
Failed []FailedPR `json:"failed,omitempty"`
MergedCount int `json:"mergedCount"`
SkippedCount int `json:"skippedCount"`
FailedCount int `json:"failedCount"`
}
MergeResult contains the results of a merge operation.
type MergedPR ¶
type MergedPR struct {
PR PullRequest `json:"pr"`
MergedBy string `json:"mergedBy"`
SHA string `json:"sha"`
}
MergedPR represents a successfully merged PR.
type PRContext ¶
type PRContext struct {
Number int `json:"number"`
Title string `json:"title"`
Author string `json:"author"`
IsDependency bool `json:"isDependency"`
DependBot string `json:"dependBot"`
AgeHours int `json:"ageHours"`
AgeDays int `json:"ageDays"`
Mergeable bool `json:"mergeable"`
Draft bool `json:"draft"`
Labels []string `json:"labels"`
HasConflicts bool `json:"hasConflicts"`
}
PRContext contains pull request information for policy evaluation.
type PRFilter ¶
type PRFilter struct {
State string `json:"state,omitempty"` // open, closed, all
DependBot DependBot `json:"dependBot,omitempty"` // renovate, dependabot, or empty for all
UpdateTypes []UpdateType `json:"updateTypes,omitempty"` // major, minor, patch
MinAgeHours int `json:"minAgeHours,omitempty"`
MaxAgeHours int `json:"maxAgeHours,omitempty"`
TestsPassed *bool `json:"testsPassed,omitempty"`
Mergeable *bool `json:"mergeable,omitempty"`
}
PRFilter defines criteria for filtering pull requests.
type PolicyAction ¶
type PolicyAction string
PolicyAction represents an action that can be evaluated against policies.
const ( PolicyActionReview PolicyAction = "review" PolicyActionMerge PolicyAction = "merge" PolicyActionRelease PolicyAction = "release" )
type PolicyContext ¶
type PolicyContext struct {
Repo RepoContext `json:"repo"`
PR PRContext `json:"pr"`
Dependency DependencyContext `json:"dependency"`
CI CIContext `json:"ci"`
}
PolicyContext provides context for Cedar policy evaluation. This struct is serialized to JSON for Cedar entity evaluation.
type PolicyDecision ¶
type PolicyDecision struct {
Allowed bool `json:"allowed"`
Action string `json:"action"`
Reasons []string `json:"reasons,omitempty"`
Policies []string `json:"policies,omitempty"`
}
PolicyDecision represents the result of policy evaluation.
type PullRequest ¶
type PullRequest struct {
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body,omitempty"`
State string `json:"state"` // open, closed
Author string `json:"author"`
HTMLURL string `json:"htmlUrl"`
IsDependency bool `json:"isDependency"`
DependBot DependBot `json:"dependBot,omitempty"`
Dependency Dependency `json:"dependency,omitempty"`
TestsPassed bool `json:"testsPassed"`
Mergeable bool `json:"mergeable"`
MergeableStr string `json:"mergeableState,omitempty"`
Draft bool `json:"draft"`
Labels []string `json:"labels,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
MergedAt *time.Time `json:"mergedAt,omitempty"`
Repo RepoRef `json:"repo"`
}
PullRequest represents a GitHub pull request, with dependency-specific metadata.
func (*PullRequest) AgeHours ¶
func (pr *PullRequest) AgeHours() int
AgeHours returns the age of the PR in hours.
func (*PullRequest) IsMerged ¶
func (pr *PullRequest) IsMerged() bool
IsMerged returns true if the PR has been merged.
type Release ¶
type Release struct {
ID int64 `json:"id"`
TagName string `json:"tagName"`
Name string `json:"name"`
Body string `json:"body,omitempty"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
CreatedAt time.Time `json:"createdAt"`
PublishedAt time.Time `json:"publishedAt"`
HTMLURL string `json:"htmlUrl"`
Repo RepoRef `json:"repo"`
}
Release represents a GitHub release.
type ReleaseCandidate ¶
type ReleaseCandidate struct {
Repo Repo `json:"repo"`
CurrentVersion string `json:"currentVersion"`
ProposedVersion string `json:"proposedVersion"`
MergedPRs []PullRequest `json:"mergedPRs"`
MergedPRCount int `json:"mergedPRCount"`
LastReleaseAt *time.Time `json:"lastReleaseAt,omitempty"`
DaysSinceRelease int `json:"daysSinceRelease,omitempty"`
ShouldRelease bool `json:"shouldRelease"`
ReleaseReason string `json:"releaseReason,omitempty"`
}
ReleaseCandidate represents a repository that may need a new release.
type ReleaseRequest ¶
type ReleaseRequest struct {
Repo RepoRef `json:"repo"`
TagName string `json:"tagName"`
TargetCommitish string `json:"targetCommitish,omitempty"` // Branch or commit SHA
Name string `json:"name"`
Body string `json:"body"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
GenerateNotes bool `json:"generateNotes"`
}
ReleaseRequest contains the information needed to create a new release.
type ReleaseResult ¶
type ReleaseResult struct {
Timestamp time.Time `json:"timestamp"`
DryRun bool `json:"dryRun"`
Created []CreatedRelease `json:"created,omitempty"`
Skipped []SkippedRelease `json:"skipped,omitempty"`
Failed []FailedRelease `json:"failed,omitempty"`
CreatedCount int `json:"createdCount"`
SkippedCount int `json:"skippedCount"`
FailedCount int `json:"failedCount"`
}
ReleaseResult contains the results of creating releases.
type Repo ¶
type Repo struct {
Owner string `json:"owner"`
Name string `json:"name"`
FullName string `json:"fullName"`
Description string `json:"description,omitempty"`
DefaultBranch string `json:"defaultBranch"`
Private bool `json:"private"`
Archived bool `json:"archived"`
Language string `json:"language,omitempty"`
Topics []string `json:"topics,omitempty"`
UpdatedAt time.Time `json:"updatedAt"`
HTMLURL string `json:"htmlUrl"`
}
Repo represents a GitHub repository.
type RepoContext ¶
type RepoContext struct {
Owner string `json:"owner"`
Name string `json:"name"`
FullName string `json:"fullName"`
Private bool `json:"private"`
Archived bool `json:"archived"`
Language string `json:"language"`
Topics []string `json:"topics"`
IsMonorepo bool `json:"isMonorepo"`
}
RepoContext contains repository information for policy evaluation.
type RepoFilter ¶
type RepoFilter struct {
IncludeArchived bool `json:"includeArchived"`
IncludePrivate bool `json:"includePrivate"`
IncludeForks bool `json:"includeForks"`
Languages []string `json:"languages,omitempty"`
Topics []string `json:"topics,omitempty"`
ExcludeRepos []string `json:"excludeRepos,omitempty"`
MinStars int `json:"minStars,omitempty"`
HasOpenDependPRs bool `json:"hasOpenDependPRs"`
}
RepoFilter defines criteria for filtering repositories.
type RepoRef ¶
RepoRef is a lightweight reference to a repository.
func ParseRepoRef ¶
ParseRepoRef parses a full name like "owner/repo" into a RepoRef.
type ReviewResult ¶
type ReviewResult struct {
Timestamp time.Time `json:"timestamp"`
DryRun bool `json:"dryRun"`
Approved []PullRequest `json:"approved,omitempty"`
Denied []DeniedPR `json:"denied,omitempty"`
ApprovedCount int `json:"approvedCount"`
DeniedCount int `json:"deniedCount"`
}
ReviewResult contains the results of reviewing PRs.
type ScanResult ¶
type ScanResult struct {
Timestamp time.Time `json:"timestamp"`
Orgs []string `json:"orgs"`
ReposScanned int `json:"reposScanned"`
PRsFound int `json:"prsFound"`
PRs []PullRequest `json:"prs"`
Errors []ScanError `json:"errors,omitempty"`
}
ScanResult contains the results of scanning for dependency PRs.
type SkippedPR ¶
type SkippedPR struct {
PR PullRequest `json:"pr"`
Reason string `json:"reason"`
}
SkippedPR represents a PR that was skipped during merge.
type SkippedRelease ¶
SkippedRelease represents a repository that was skipped for release.
type UpdateType ¶
type UpdateType string
UpdateType represents the semantic version update type.
const ( UpdateTypeMajor UpdateType = "major" UpdateTypeMinor UpdateType = "minor" UpdateTypePatch UpdateType = "patch" UpdateTypeUnknown UpdateType = "unknown" )