Documentation
¶
Index ¶
- func IsNewer(v1, v2 string) bool
- type ActionReference
- type DefaultPRCreator
- type DefaultUpdateManager
- func (m *DefaultUpdateManager) ApplyUpdates(ctx context.Context, updates []*Update) error
- func (m *DefaultUpdateManager) CreateUpdate(ctx context.Context, file string, action ActionReference, latestVersion string, ...) (*Update, error)
- func (m *DefaultUpdateManager) PreserveComments(action ActionReference) []string
- type DefaultVersionChecker
- func (c *DefaultVersionChecker) GetCommitHash(ctx context.Context, action ActionReference, version string) (string, error)
- func (c *DefaultVersionChecker) GetLatestVersion(ctx context.Context, action ActionReference) (string, string, error)
- func (c *DefaultVersionChecker) IsUpdateAvailable(ctx context.Context, action ActionReference) (bool, string, string, error)
- type PRCreator
- type Scanner
- type Update
- type UpdateManager
- type VersionChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActionReference ¶
type ActionReference struct {
Owner string
Name string
Version string
CommitHash string
Path string
Line int
Comments []string
VersionComment string // Comment indicating version (e.g., "# v3")
OriginalVersion string // For tracking version history
}
ActionReference represents a GitHub Action reference in a workflow file
type DefaultPRCreator ¶
type DefaultPRCreator struct {
// contains filtered or unexported fields
}
DefaultPRCreator implements the PRCreator interface
func NewPRCreator ¶
func NewPRCreator(token, owner, repo string) *DefaultPRCreator
NewPRCreator creates a new instance of DefaultPRCreator
type DefaultUpdateManager ¶
type DefaultUpdateManager struct {
// contains filtered or unexported fields
}
DefaultUpdateManager implements the UpdateManager interface
func NewUpdateManager ¶
func NewUpdateManager(baseDir string) *DefaultUpdateManager
NewUpdateManager creates a new instance of DefaultUpdateManager
func (*DefaultUpdateManager) ApplyUpdates ¶
func (m *DefaultUpdateManager) ApplyUpdates(ctx context.Context, updates []*Update) error
ApplyUpdates applies the given updates to workflow files
func (*DefaultUpdateManager) CreateUpdate ¶
func (m *DefaultUpdateManager) CreateUpdate(ctx context.Context, file string, action ActionReference, latestVersion string, commitHash string) (*Update, error)
CreateUpdate creates an update for a given action and its latest version
func (*DefaultUpdateManager) PreserveComments ¶
func (m *DefaultUpdateManager) PreserveComments(action ActionReference) []string
PreserveComments preserves existing comments when updating an action
type DefaultVersionChecker ¶
type DefaultVersionChecker struct {
// contains filtered or unexported fields
}
DefaultVersionChecker implements the VersionChecker interface using GitHub API
func NewDefaultVersionChecker ¶
func NewDefaultVersionChecker(token string) *DefaultVersionChecker
NewDefaultVersionChecker creates a new DefaultVersionChecker instance
func (*DefaultVersionChecker) GetCommitHash ¶
func (c *DefaultVersionChecker) GetCommitHash(ctx context.Context, action ActionReference, version string) (string, error)
GetCommitHash returns the commit hash for a specific version of an action
func (*DefaultVersionChecker) GetLatestVersion ¶
func (c *DefaultVersionChecker) GetLatestVersion(ctx context.Context, action ActionReference) (string, string, error)
GetLatestVersion returns the latest version and its commit hash for a given action
func (*DefaultVersionChecker) IsUpdateAvailable ¶
func (c *DefaultVersionChecker) IsUpdateAvailable(ctx context.Context, action ActionReference) (bool, string, string, error)
IsUpdateAvailable checks if a newer version is available
type PRCreator ¶
type PRCreator interface {
// CreatePR creates a pull request with the given updates
CreatePR(ctx context.Context, updates []*Update) error
}
PRCreator creates pull requests for GitHub Action updates
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner handles scanning and parsing of workflow files
func NewScanner ¶
NewScanner creates a new Scanner instance
func (*Scanner) ParseActionReferences ¶
func (s *Scanner) ParseActionReferences(path string) ([]ActionReference, error)
ParseActionReferences extracts action references from a workflow file
func (*Scanner) ScanWorkflows ¶
ScanWorkflows finds all GitHub Actions workflow files in the repository
type Update ¶
type Update struct {
Action ActionReference
OldVersion string
NewVersion string
OldHash string
NewHash string
FilePath string
LineNumber int
Description string
Comments []string // Preserved comments
VersionComment string // New version comment
OriginalVersion string // For tracking version history
}
Update represents a pending update for a GitHub Action
type UpdateManager ¶
type UpdateManager interface {
// CreateUpdate creates an update for a given action and its latest version
// Now includes commit hash and preserves comments
CreateUpdate(ctx context.Context, file string, action ActionReference, latestVersion string, commitHash string) (*Update, error)
// ApplyUpdates applies the given updates to workflow files
// Now handles comment preservation and hash updates
ApplyUpdates(ctx context.Context, updates []*Update) error
// PreserveComments preserves existing comments when updating an action
PreserveComments(action ActionReference) []string
}
UpdateManager manages the process of updating GitHub Actions
type VersionChecker ¶
type VersionChecker interface {
// GetLatestVersion returns the latest version and its commit hash for a given action
GetLatestVersion(ctx context.Context, action ActionReference) (version string, hash string, err error)
// IsUpdateAvailable checks if a newer version is available
// Returns: available, new version, new hash, error
IsUpdateAvailable(ctx context.Context, action ActionReference) (bool, string, string, error)
// GetCommitHash returns the commit hash for a specific version of an action
GetCommitHash(ctx context.Context, action ActionReference, version string) (string, error)
}
VersionChecker checks for newer versions of GitHub Actions