Documentation
¶
Index ¶
- func GetArtifactsDir(ctx context.Context) string
- func GetCacheDir(ctx context.Context) string
- func GetJobID(ctx context.Context) string
- func WithHostDirs(ctx context.Context, cacheDir, artifactsDir string) context.Context
- func WithJobID(ctx context.Context, jobID string) context.Context
- type ActionHandler
- type ActionRef
- type ActionResult
- func ExecuteCache(ctx context.Context, cli *client.Client, containerID, workingDir string, ...) (*ActionResult, error)
- func ExecuteCheckout(ctx context.Context, cli *client.Client, containerID, workingDir string, ...) (*ActionResult, error)
- func ExecuteDownloadArtifact(ctx context.Context, cli *client.Client, containerID, workingDir string, ...) (*ActionResult, error)
- func ExecuteSetupPython(ctx context.Context, cli *client.Client, containerID, workingDir string, ...) (*ActionResult, error)
- func ExecuteUploadArtifact(ctx context.Context, cli *client.Client, containerID, workingDir string, ...) (*ActionResult, error)
- type ActionValidationError
- type Registry
- type UnsupportedActionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetArtifactsDir ¶
GetArtifactsDir retrieves the host artifacts directory from context, defaulting to ".gacils-artifacts".
func GetCacheDir ¶
GetCacheDir retrieves the host cache directory from context, defaulting to ".gacils-cache".
func WithHostDirs ¶
WithHostDirs returns a context with host cache and artifacts directories.
Types ¶
type ActionHandler ¶
type ActionHandler func(ctx context.Context, cli *client.Client, containerID, workingDir string, with map[string]any) (*ActionResult, error)
ActionHandler defines the signature for an action simulation handler.
type ActionRef ¶
ActionRef represents a parsed action reference (e.g. actions/checkout@v4).
func ParseActionRef ¶
ParseActionRef parses a step's uses string into an ActionRef.
func (ActionRef) ActionName ¶
ActionName returns the "owner/repo" format of the action.
type ActionResult ¶
ActionResult holds output logs and environment changes from an action simulation.
func ExecuteCache ¶
func ExecuteCache(ctx context.Context, cli *client.Client, containerID, workingDir string, with map[string]any) (*ActionResult, error)
ExecuteCache simulates actions/cache.
func ExecuteCheckout ¶
func ExecuteCheckout(ctx context.Context, cli *client.Client, containerID, workingDir string, with map[string]any) (*ActionResult, error)
ExecuteCheckout simulates actions/checkout. Workspace copy is already performed, so this verifies the workspace container path exists.
func ExecuteDownloadArtifact ¶
func ExecuteDownloadArtifact(ctx context.Context, cli *client.Client, containerID, workingDir string, with map[string]any) (*ActionResult, error)
ExecuteDownloadArtifact simulates actions/download-artifact.
type ActionValidationError ¶
type ActionValidationError struct {
Message string
}
ActionValidationError represents a validation error for action inputs. Exit code 2.
func NewActionValidationError ¶
func NewActionValidationError(msg string) *ActionValidationError
NewActionValidationError creates a new ActionValidationError.
func (*ActionValidationError) Code ¶
func (e *ActionValidationError) Code() int
func (*ActionValidationError) Error ¶
func (e *ActionValidationError) Error() string
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages supported GitHub actions.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates and initializes an Action Registry with default supported actions.
func (*Registry) Execute ¶
func (r *Registry) Execute(ctx context.Context, cli *client.Client, containerID, workingDir string, ref ActionRef, with map[string]any) (*ActionResult, error)
Execute runs the handler for the given ActionRef or returns an UnsupportedActionError.
func (*Registry) IsSupported ¶
IsSupported checks whether an ActionRef is registered.
func (*Registry) Register ¶
func (r *Registry) Register(name string, handler ActionHandler)
Register registers a handler for a given action name (e.g. "actions/checkout").
type UnsupportedActionError ¶
type UnsupportedActionError struct {
Action string
}
UnsupportedActionError represents an error when an action is not supported. Exit code 3.
func NewUnsupportedActionError ¶
func NewUnsupportedActionError(action string) *UnsupportedActionError
NewUnsupportedActionError creates a new UnsupportedActionError.
func (*UnsupportedActionError) Code ¶
func (e *UnsupportedActionError) Code() int
func (*UnsupportedActionError) Error ¶
func (e *UnsupportedActionError) Error() string