actions

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const CommitLogFormat = "--pretty=format:%H|%s|%b<<<END>>>"

CommitLogFormat is the git log format ParseCommitLog reads.

View Source
const ReleaseNotesFilePattern = ".cidx/release-notes-v%s.md"

ReleaseNotesFilePattern is the pattern for release notes files

View Source
const ReleaseVersionFile = ".cidx/release-version"

ReleaseVersionFile is the path where the target version is stored

View Source
const TagMessageFile = ".cidx/tag-message"

TagMessageFile is the path where the tag message is stored

View Source
const TagVersionFile = ".cidx/tag-version"

TagVersionFile is the path where the target tag version is stored

Variables

This section is empty.

Functions

func CleanupPreparedNotes

func CleanupPreparedNotes(workDir, version string) error

CleanupPreparedNotes removes the release notes file after successful release

func CleanupPreparedTagVersion

func CleanupPreparedTagVersion(workDir string) error

CleanupPreparedTagVersion removes the version file after successful tag creation

func CleanupPreparedVersion

func CleanupPreparedVersion(workDir string) error

CleanupPreparedVersion removes the version file after successful release

func CleanupTagMessage

func CleanupTagMessage(workDir string) error

CleanupTagMessage removes the message file after successful tag creation

func DisplayWorkflowStatus

func DisplayWorkflowStatus(w *remote.Workflow)

DisplayWorkflowStatus renders the current workflow status to stdout Used by release, commit-push-watch, and other actions that watch workflows

func GetReleaseNotesFile

func GetReleaseNotesFile(version string) string

GetReleaseNotesFile returns the path for release notes with the given version

func HasPreparedNotes

func HasPreparedNotes(workDir, version string) bool

HasPreparedNotes checks if release notes have been prepared for the given version

func HasPreparedTagVersion

func HasPreparedTagVersion(workDir string) bool

HasPreparedTagVersion checks if a tag version has been prepared

func HasPreparedVersion

func HasPreparedVersion(workDir string) bool

HasPreparedVersion checks if a version has been prepared

func HasTagMessage

func HasTagMessage(workDir string) bool

HasTagMessage checks if a tag message has been prepared

func LoadPreparedNotes

func LoadPreparedNotes(workDir, version string) (string, error)

LoadPreparedNotes loads previously prepared release notes for the given version

func LoadPreparedTagVersion

func LoadPreparedTagVersion(workDir string) (string, error)

LoadPreparedTagVersion loads the target version from file

func LoadPreparedVersion

func LoadPreparedVersion(workDir string) (string, error)

LoadPreparedVersion loads the target version from file

func LoadTagMessage

func LoadTagMessage(workDir string) (string, error)

LoadTagMessage loads the tag message from file

func NextVersion added in v2.1.4

func NextVersion(current string, counts CommitCounts) string

NextVersion applies the semantic bump implied by counts to current.

func SavePreparedTagVersion

func SavePreparedTagVersion(workDir, version string) error

SavePreparedTagVersion saves the target version to a file

func SavePreparedVersion

func SavePreparedVersion(workDir, version string) error

SavePreparedVersion saves the target version to a file

func SaveTagMessage

func SaveTagMessage(workDir, message string) error

SaveTagMessage saves the tag message to a file

func SuggestTagVersion added in v2.1.4

func SuggestTagVersion(workDir string) string

SuggestTagVersion returns the version the tag flow should create: the pending one when a bump already landed untagged, otherwise the semantic bump of the latest tag.

Types

type ArtifactCleanupAction

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

ArtifactCleanupAction deletes artifacts

func NewArtifactCleanup

func NewArtifactCleanup(provider remote.Provider, deleteAll, expired bool, olderThan int, dryRun bool) *ArtifactCleanupAction

NewArtifactCleanup creates a new artifact cleanup action

func (*ArtifactCleanupAction) Execute

func (a *ArtifactCleanupAction) Execute(ctx context.Context) error

Execute runs the artifact cleanup action

type ArtifactListAction

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

ArtifactListAction lists all artifacts

func NewArtifactList

func NewArtifactList(provider remote.Provider, verbose bool) *ArtifactListAction

NewArtifactList creates a new artifact list action

func (*ArtifactListAction) Execute

func (a *ArtifactListAction) Execute(ctx context.Context) error

Execute runs the artifact list action

type ArtifactProvider

type ArtifactProvider interface {
	ListArtifacts(ctx context.Context) (*remote.ArtifactStats, error)
	DeleteArtifact(ctx context.Context, artifactID int64) error
	DeleteArtifactsBefore(ctx context.Context, before time.Time) (deleted int, freedBytes int64, err error)
	DeleteAllArtifacts(ctx context.Context) (deleted int, freedBytes int64, err error)
	DeleteExpiredArtifacts(ctx context.Context) (deleted int, freedBytes int64, err error)
}

ArtifactProvider is the interface for artifact operations Only GitHub supports artifacts currently

type ArtifactStatsAction

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

ArtifactStatsAction shows artifact storage statistics

func NewArtifactStats

func NewArtifactStats(provider remote.Provider) *ArtifactStatsAction

NewArtifactStats creates a new artifact stats action

func (*ArtifactStatsAction) Execute

func (a *ArtifactStatsAction) Execute(ctx context.Context) error

Execute runs the artifact stats action

type CommitCounts added in v2.1.4

type CommitCounts struct {
	Breaking int
	Feat     int
	Fix      int
	Other    int
}

CommitCounts is the conventional-commit breakdown of a commit range.

func CountCommitInfos added in v2.1.4

func CountCommitInfos(commits []CommitInfo) CommitCounts

CountCommitInfos is countCommits for callers that already parsed the range.

func (CommitCounts) Total added in v2.1.4

func (c CommitCounts) Total() int

Total returns the number of commits in the range.

type CommitInfo

type CommitInfo struct {
	Hash     string
	Type     string
	Scope    string
	Subject  string
	Body     string
	PR       int
	Breaking bool
}

CommitInfo holds parsed commit information

func ParseCommit added in v2.1.5

func ParseCommit(subject, body string) CommitInfo

ParseCommit is the single conventional-commit parser of the release flow: prepare, preview, tag and the TUI all classify commits through it, so they cannot disagree on a version bump. Subjects that are not conventional keep type "other" and their raw text.

func ParseCommitLog added in v2.1.5

func ParseCommitLog(output string) []CommitInfo

ParseCommitLog parses `git log CommitLogFormat` output into commits.

type CommitPushWatchAction

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

CommitPushWatchAction orchestrates commit, push, and CI watching

func NewCommitPushWatch

func NewCommitPushWatch(repo *vcs.Repository, provider remote.Provider, message string) *CommitPushWatchAction

NewCommitPushWatch creates a new commit-push-watch action

func (*CommitPushWatchAction) Execute

func (a *CommitPushWatchAction) Execute(ctx context.Context) error

Execute runs the action: commit → push → watch

type PRAction

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

PRAction manages pull request workflow

func NewPR

func NewPR(repo *vcs.Repository, provider remote.Provider, title, issueNum string, dryRun, readyMode bool) *PRAction

NewPR creates a new PR action

func NewPRMerge

func NewPRMerge(repo *vcs.Repository, provider remote.Provider, mergeMethod string, watchFlow, skipChecks, dryRun bool) *PRAction

NewPRMerge creates a new PR merge action

func (*PRAction) Execute

func (a *PRAction) Execute(ctx context.Context) error

Execute runs the PR workflow

type PREditAction

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

PREditAction updates the title and/or body of the current branch's PR.

func NewPREdit

func NewPREdit(repo *vcs.Repository, provider remote.Provider, title, body string) *PREditAction

NewPREdit creates a new PR edit action. Empty title/body fields are left unchanged on the PR; at least one must be provided.

func (*PREditAction) Execute

func (a *PREditAction) Execute(ctx context.Context) error

Execute resolves the current branch and updates its PR.

type PRInfo

type PRInfo struct {
	Number int
	Title  string
	Author string
}

PRInfo holds PR information

type ReleaseAction

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

ReleaseAction orchestrates the release process using dynamic action configuration

func NewRelease

func NewRelease(repo *vcs.Repository, provider remote.Provider, releaseConfig config.ReleaseConfig, actionName string, dryRun bool) *ReleaseAction

NewRelease creates a new release action

func (*ReleaseAction) Execute

func (a *ReleaseAction) Execute(ctx context.Context) error

Execute runs the release workflow using dynamic action configuration

type ReleaseCommitAction

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

ReleaseCommitAction commits prepared release notes

func NewReleaseCommit

func NewReleaseCommit(repo *vcs.Repository, dryRun bool) *ReleaseCommitAction

NewReleaseCommit creates a new release commit action

func (*ReleaseCommitAction) Execute

func (a *ReleaseCommitAction) Execute(ctx context.Context) error

Execute commits the prepared release notes

type ReleasePrepareAction

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

ReleasePrepareAction prepares release notes for human review

func NewReleasePrepare

func NewReleasePrepare(repo *vcs.Repository, provider remote.Provider, releaseConfig config.ReleaseConfig, dryRun bool) *ReleasePrepareAction

NewReleasePrepare creates a new release prepare action

func (*ReleasePrepareAction) Execute

func (a *ReleasePrepareAction) Execute(ctx context.Context) error

Execute prepares release notes and opens editor for review

type ReleasePreviewAction

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

ReleasePreviewAction shows what will happen during release

func NewReleasePreview

func NewReleasePreview(repo *vcs.Repository, releaseConfig config.ReleaseConfig, dryRun bool) *ReleasePreviewAction

NewReleasePreview creates a new release preview action

func (*ReleasePreviewAction) Execute

func (a *ReleasePreviewAction) Execute(ctx context.Context) error

Execute shows a preview of the release

type TagCreateAction

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

TagCreateAction creates and optionally pushes a git tag

func NewTagCreate

func NewTagCreate(repo *vcs.Repository, tagConfig config.TagConfig, dryRun bool) *TagCreateAction

NewTagCreate creates a new tag create action

func (*TagCreateAction) Execute

func (a *TagCreateAction) Execute(ctx context.Context) error

Execute creates the tag and optionally pushes it

type TagDeleteAction

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

TagDeleteAction deletes a git tag locally and optionally from remote

func NewTagDelete

func NewTagDelete(repo *vcs.Repository, tagConfig config.TagConfig, tagName string, remote, force, dryRun bool) *TagDeleteAction

NewTagDelete creates a new tag delete action

func (*TagDeleteAction) Execute

func (a *TagDeleteAction) Execute(ctx context.Context) error

Execute deletes the specified tag

type TagListAction

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

TagListAction lists git tags with filtering options

func NewTagList

func NewTagList(repo *vcs.Repository, tagConfig config.TagConfig, limit int, pattern string, verbose bool) *TagListAction

NewTagList creates a new tag list action

func (*TagListAction) Execute

func (a *TagListAction) Execute(ctx context.Context) error

Execute lists tags based on configuration

type TagPrepareAction

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

TagPrepareAction prepares a tag for human review before creation

func NewTagPrepare

func NewTagPrepare(repo *vcs.Repository, tagConfig config.TagConfig, dryRun bool) *TagPrepareAction

NewTagPrepare creates a new tag prepare action

func (*TagPrepareAction) Execute

func (a *TagPrepareAction) Execute(ctx context.Context) error

Execute prepares a tag version and message for review

type TagPreviewAction

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

TagPreviewAction shows what will happen during tag creation

func NewTagPreview

func NewTagPreview(repo *vcs.Repository, tagConfig config.TagConfig) *TagPreviewAction

NewTagPreview creates a new tag preview action

func (*TagPreviewAction) Execute

func (a *TagPreviewAction) Execute(ctx context.Context) error

Execute shows a preview of the tag operation

type VersionState added in v2.1.4

type VersionState struct {
	LastTag     string // "v2.1.3", empty when the repo has no tag
	TagVersion  string // "2.1.3", empty when there is no tag or it is not semver
	FileVersion string // VERSION file contents, empty when unreadable
}

VersionState reconciles the two places the release flow can read a "current version" from: the VERSION file (what commitizen bumps) and the latest git tag (what was actually released). They can disagree -- a tag cut outside the flow, or a bump commit that never got tagged -- and computing the next version from the wrong one yields a version below the latest tag (issue #185). The tag is the source of truth; a disagreement is reported, never silently resolved.

func ResolveVersion added in v2.1.4

func ResolveVersion(workDir string) VersionState

ResolveVersion reads both sources and returns their reconciliation.

func (VersionState) Current added in v2.1.4

func (s VersionState) Current() string

Current returns the version the release flow must compute from: the latest tag, falling back to the version files only when nothing was ever tagged.

func (VersionState) Diverged added in v2.1.4

func (s VersionState) Diverged() bool

Diverged reports whether the version files disagree with the latest tag.

func (VersionState) DivergenceError added in v2.1.4

func (s VersionState) DivergenceError() error

DivergenceError names both values and the way out, or nil when they agree.

func (VersionState) FilesAhead added in v2.1.4

func (s VersionState) FilesAhead() bool

FilesAhead reports a version bump that landed in the files but was never tagged -- the state `cidx release tag create` exists to close.

func (VersionState) LastTagDisplay added in v2.1.4

func (s VersionState) LastTagDisplay() string

LastTagDisplay returns the latest tag, or "(none)" when the repo has none.

type WorkflowListAction

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

WorkflowListAction lists workflow runs from GitHub Actions

func NewWorkflowList

func NewWorkflowList(workflow string, limit int, verbose bool) *WorkflowListAction

NewWorkflowList creates a new workflow list action

func (*WorkflowListAction) Execute

func (a *WorkflowListAction) Execute(ctx context.Context) error

Execute lists workflow runs from GitHub Actions

type WorkflowRun

type WorkflowRun struct {
	ID           int64     `json:"id"`
	Name         string    `json:"name"`
	HeadBranch   string    `json:"head_branch"`
	HeadSha      string    `json:"head_sha"`
	Status       string    `json:"status"`
	Conclusion   string    `json:"conclusion"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
	HTMLURL      string    `json:"html_url"`
	RunNumber    int       `json:"run_number"`
	DisplayTitle string    `json:"display_title"`
}

WorkflowRun represents a GitHub Actions workflow run

type WorkflowRunsResponse

type WorkflowRunsResponse struct {
	TotalCount   int           `json:"total_count"`
	WorkflowRuns []WorkflowRun `json:"workflow_runs"`
}

WorkflowRunsResponse represents the GitHub API response for workflow runs

type WorkflowWatchAction

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

WorkflowWatchAction watches a single workflow run, selected by branch, tag or run ID. It complements `cidx pr watch` by supporting non-PR branches such as direct pushes to main (issue #125) and tag pushes (issue #223).

func NewWorkflowWatch

func NewWorkflowWatch(provider remote.Provider, branch, tag, runID string, quiet bool) *WorkflowWatchAction

NewWorkflowWatch creates a new workflow watch action.

Exactly one of branch, tag or runID should be set. A branch or a tag resolves to the most recent run on that ref; a run ID watches that run directly. When several are set, the most specific wins: runID, then tag, then branch.

func (*WorkflowWatchAction) Execute

func (a *WorkflowWatchAction) Execute(ctx context.Context) error

Execute resolves the run to watch, then streams updates until completion.

Jump to

Keyboard shortcuts

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