Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateMode(mode ReleaseMode) error
- type BumpType
- type ChangelogGroupJSON
- type ChangelogJSON
- type ChangelogOptions
- type CommitJSON
- type CommitTypeInfo
- type CutOptions
- type CutResult
- type FileMutation
- type ParsedCommit
- type PlanOptions
- type PublishOptions
- type PublishResult
- type ReleaseMode
- type ReleasePlan
- type ReleaseService
- type Version
Constants ¶
const ( BumpMajor = version.BumpMajor BumpMinor = version.BumpMinor BumpPatch = version.BumpPatch BumpNone = version.BumpNone )
Re-export version constants for backward compatibility
Variables ¶
var ( ParseVersion = version.ParseVersion ZeroVersion = version.ZeroVersion ComputeNextVersion = version.ComputeNextVersion ParseConventionalCommit = version.ParseConventionalCommit FilterReleasableCommits = version.FilterReleasableCommits ExtractBreakingChanges = version.ExtractBreakingChanges GroupCommitsByType = version.GroupCommitsByType GetCommitTypeInfo = version.GetCommitTypeInfo )
Re-export version functions for backward compatibility
var ( OpenRepository = githelper.OpenRepository DiscoverLatestTag = githelper.DiscoverLatestTag GetCommitsSinceTag = githelper.GetCommitsSinceTag GetRepositoryName = githelper.GetRepositoryName ParseCommits = githelper.ParseCommits )
Re-export git helper functions for backward compatibility
var ( GenerateChangelog = changelog.GenerateChangelog GenerateChangelogPreview = changelog.GenerateChangelogPreview GenerateChangelogJSON = changelog.GenerateChangelogJSON GetCommitStats = changelog.GetCommitStats )
Re-export changelog functions for backward compatibility
Functions ¶
func ValidateMode ¶
func ValidateMode(mode ReleaseMode) error
ValidateMode checks that a ReleaseMode string is one of the allowed values.
Types ¶
type ChangelogGroupJSON ¶
ChangelogGroupJSON is an alias for changelog.GroupJSON for backward compatibility
type ChangelogJSON ¶
ChangelogJSON is an alias for changelog.JSON for backward compatibility
type ChangelogOptions ¶
ChangelogOptions is an alias for changelog.Options for backward compatibility
type CommitJSON ¶
type CommitJSON = changelog.CommitJSON
CommitJSON is an alias for changelog.CommitJSON for backward compatibility
type CommitTypeInfo ¶
type CommitTypeInfo = version.CommitTypeInfo
CommitTypeInfo is an alias for version.CommitTypeInfo for backward compatibility
type CutOptions ¶
type CutOptions struct {
RepoPath string // path to git repo (default ".")
Branch string // expected branch (default "main")
Remote string // git remote name (default "origin")
PlanFile string // path to pre-generated plan JSON/YAML
MutationsConfig string // path to mutations config file
DryRun bool // show what would happen without side effects
Publish bool // create published release directly (no draft)
Mode ReleaseMode // "auto" (default), "api", "local"
CommitAuthor string // bot commit author name
CommitEmail string // bot commit author email
Token string // GitHub token for API and push
ReleaseAPI ReleaseService // optional; created from Token if nil
Assets []string // file paths to upload as release assets
AssetLabels map[string]string // optional asset name -> display label
}
CutOptions contains configuration for executing a release cut
func DefaultCutOptions ¶
func DefaultCutOptions() *CutOptions
DefaultCutOptions returns options with sensible defaults
type CutResult ¶
type CutResult struct {
TagName string `json:"tag_name"`
Version string `json:"version"`
CommitSHA string `json:"commit_sha"`
ReleaseURL string `json:"release_url,omitempty"`
ReleaseID int64 `json:"release_id,omitempty"`
Draft bool `json:"draft"`
Published bool `json:"published"`
FilesModified []string `json:"files_modified,omitempty"`
UploadedAssets []string `json:"uploaded_assets,omitempty"`
DryRun bool `json:"dry_run"`
NoRelease bool `json:"no_release"`
Reason string `json:"reason,omitempty"`
}
CutResult captures the outcome of a release cut
func ExecuteCut ¶
func ExecuteCut(opts *CutOptions) (*CutResult, error)
ExecuteCut orchestrates the full release cut flow
type FileMutation ¶
type FileMutation struct {
Path string `json:"path" yaml:"path"`
Type string `json:"type" yaml:"type"` // jsonPath, yamlPath, regex
Field string `json:"field" yaml:"field"` // field being modified
OldValue string `json:"old_value" yaml:"old_value"` // current value
NewValue string `json:"new_value" yaml:"new_value"` // value after release
}
FileMutation represents a file change that would occur during release
type ParsedCommit ¶
type ParsedCommit = version.ParsedCommit
ParsedCommit is an alias for version.ParsedCommit for backward compatibility.
type PlanOptions ¶
type PlanOptions struct {
// base ref to compare from (default: latest tag)
FromRef string
// target ref to compare to (default: HEAD)
ToRef string
// only follow first parent in merge commits
FirstParent bool
// path to repository (default: current directory)
RepoPath string
// output format (text, json, yaml)
OutputFormat string
// path to mutations config file (optional)
MutationsConfig string
// release mode: "auto" (default), "api", "local"
Mode ReleaseMode
// GitHub API client for API mode tag/commit discovery (optional)
ReleaseAPI ReleaseService
// branch name used as head for API compare (required for API mode)
Branch string
}
PlanOptions contains options for generating a release plan
func DefaultPlanOptions ¶
func DefaultPlanOptions() *PlanOptions
DefaultPlanOptions returns options with sensible defaults
type PublishOptions ¶
type PublishOptions struct {
RepoPath string // path to git repo (for remote detection)
Tag string // specific tag to publish (mutually exclusive with Latest and ReleaseID)
Latest bool // find latest draft (mutually exclusive with Tag and ReleaseID)
ReleaseID int64 // publish by numeric release ID — works with GitHub App tokens
// Note: --tag and --latest require a user token; GitHub App tokens cannot discover
// draft releases via list/search endpoints. Use --release-id for App token workflows.
Token string // GitHub token (required)
DryRun bool // preview only, don't publish
ReleaseAPI ReleaseService // optional; created from Token if nil
}
PublishOptions contains configuration for publishing a draft release
type PublishResult ¶
type PublishResult struct {
TagName string `json:"tag_name"`
ReleaseURL string `json:"release_url"`
ReleaseID int64 `json:"release_id"`
Published bool `json:"published"` // always true on success
DryRun bool `json:"dry_run"`
}
PublishResult captures the outcome of a release publish
func ExecutePublish ¶
func ExecutePublish(opts *PublishOptions) (*PublishResult, error)
ExecutePublish orchestrates the full release publish flow
func (*PublishResult) ToJSON ¶
func (r *PublishResult) ToJSON() ([]byte, error)
ToJSON serializes the publish result to JSON
type ReleaseMode ¶
type ReleaseMode string
ReleaseMode controls how autogov performs git read operations
const ( ModeAuto ReleaseMode = "auto" // use API if token present; fall back to local on error ModeAPI ReleaseMode = "api" // require GitHub API, fail hard on error ModeLocal ReleaseMode = "local" // use local go-git only (offline) )
type ReleasePlan ¶
type ReleasePlan struct {
// metadata
GeneratedAt time.Time `json:"generated_at" yaml:"generated_at"`
Repository string `json:"repository" yaml:"repository"`
// version info
CurrentVersion string `json:"current_version" yaml:"current_version"`
NextVersion string `json:"next_version" yaml:"next_version"`
BumpType string `json:"bump_type" yaml:"bump_type"` // major/minor/patch/none
// commits
Commits []ParsedCommit `json:"commits" yaml:"commits"`
BreakingChanges []string `json:"breaking_changes" yaml:"breaking_changes"`
// changelog
ChangelogPreview string `json:"changelog_preview" yaml:"changelog_preview"`
// file mutations
FileMutations []FileMutation `json:"file_mutations,omitempty" yaml:"file_mutations,omitempty"`
// status
ReleaseNeeded bool `json:"release_needed" yaml:"release_needed"`
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
}
ReleasePlan contains all information about a planned release
func GeneratePlan ¶
func GeneratePlan(opts *PlanOptions) (*ReleasePlan, error)
GeneratePlan generates a complete release plan
func (*ReleasePlan) ToJSON ¶
func (p *ReleasePlan) ToJSON() ([]byte, error)
ToJSON converts the plan to JSON format
func (*ReleasePlan) ToText ¶
func (p *ReleasePlan) ToText() string
ToText converts the plan to human-readable text format
func (*ReleasePlan) ToYAML ¶
func (p *ReleasePlan) ToYAML() ([]byte, error)
ToYAML converts the plan to YAML format
type ReleaseService ¶
type ReleaseService interface {
// release operations
GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*gogithub.RepositoryRelease, *gogithub.Response, error)
GetRelease(ctx context.Context, owner, repo string, id int64) (*gogithub.RepositoryRelease, *gogithub.Response, error)
CreateRelease(ctx context.Context, owner, repo string, release *gogithub.RepositoryRelease) (*gogithub.RepositoryRelease, *gogithub.Response, error)
UpdateRelease(ctx context.Context, owner, repo string, id int64, release *gogithub.RepositoryRelease) (*gogithub.RepositoryRelease, *gogithub.Response, error)
ListReleases(ctx context.Context, owner, repo string, opts *gogithub.ListOptions) ([]*gogithub.RepositoryRelease, *gogithub.Response, error)
UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *gogithub.UploadOptions, file *os.File) (*gogithub.ReleaseAsset, *gogithub.Response, error)
// read operations (tag discovery, commit comparison, branch validation)
ListTags(ctx context.Context, owner, repo string, opts *gogithub.ListOptions) ([]*gogithub.RepositoryTag, *gogithub.Response, error)
CompareCommits(ctx context.Context, owner, repo, base, head string, opts *gogithub.ListOptions) (*gogithub.CommitsComparison, *gogithub.Response, error)
GetBranch(ctx context.Context, owner, repo, branch string, maxRedirects int) (*gogithub.Branch, *gogithub.Response, error)
// git data operations (commits/tags created via API are auto-signed by GitHub per SLSA v1.2)
CreateTree(ctx context.Context, owner, repo, baseTree string, entries []*gogithub.TreeEntry) (*gogithub.Tree, *gogithub.Response, error)
CreateCommit(ctx context.Context, owner, repo string, commit gogithub.Commit, opts *gogithub.CreateCommitOptions) (*gogithub.Commit, *gogithub.Response, error)
CreateTag(ctx context.Context, owner, repo string, tag gogithub.CreateTag) (*gogithub.Tag, *gogithub.Response, error)
CreateRef(ctx context.Context, owner, repo string, ref gogithub.CreateRef) (*gogithub.Reference, *gogithub.Response, error)
UpdateRef(ctx context.Context, owner, repo, ref string, updateRef gogithub.UpdateRef) (*gogithub.Reference, *gogithub.Response, error)
DeleteRef(ctx context.Context, owner, repo, ref string) (*gogithub.Response, error)
}
ReleaseService abstracts GitHub API operations for testability