// Copyright 2026 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT package structs // RunnerCapability represents the detailed capabilities of a runner type RunnerCapability struct { OS string `json:"os"` Arch string `json:"arch"` Docker bool `json:"docker"` DockerCompose bool `json:"docker_compose"` ContainerRuntime string `json:"container_runtime,omitempty"` Shell []string `json:"shell,omitempty"` Tools map[string][]string `json:"tools,omitempty"` Features *CapabilityFeatures `json:"features,omitempty"` Limitations []string `json:"limitations,omitempty"` } // CapabilityFeatures represents feature support flags type CapabilityFeatures struct { ArtifactsV4 bool `json:"artifacts_v4"` Cache bool `json:"cache"` Services bool `json:"services"` CompositeActions bool `json:"composite_actions"` } // ActionSupport represents version support for an action type ActionSupport struct { Versions []string `json:"versions"` Notes string `json:"notes,omitempty"` } // PlatformInfo represents Gitea platform capabilities type PlatformInfo struct { Type string `json:"type"` Version string `json:"version"` ActionsVersion string `json:"actions_version,omitempty"` DefaultActionsURL string `json:"default_actions_url"` SupportedActions map[string]ActionSupport `json:"supported_actions,omitempty"` UnsupportedFeatures []string `json:"unsupported_features,omitempty"` } // WorkflowHints provides hints for AI workflow generation type WorkflowHints struct { PreferredCheckout string `json:"preferred_checkout,omitempty"` ArtifactUploadAlternative string `json:"artifact_upload_alternative,omitempty"` SecretAccess string `json:"secret_access,omitempty"` } // RunnerWithCapabilities represents a runner with its capabilities for API response type RunnerWithCapabilities struct { ID int64 `json:"id"` Name string `json:"name"` Status string `json:"status"` Labels []string `json:"labels"` Capabilities *RunnerCapability `json:"capabilities,omitempty"` } // ActionsCapabilitiesResponse is the response for the capabilities endpoint type ActionsCapabilitiesResponse struct { Runners []*RunnerWithCapabilities `json:"runners"` Platform *PlatformInfo `json:"platform"` WorkflowHints *WorkflowHints `json:"workflow_hints,omitempty"` } // WorkflowValidationRequest is the request for workflow validation type WorkflowValidationRequest struct { Content string `json:"content" binding:"Required"` } // WorkflowValidationWarning represents a validation warning type WorkflowValidationWarning struct { Line int `json:"line,omitempty"` Action string `json:"action,omitempty"` Severity string `json:"severity"` Message string `json:"message"` Suggestion string `json:"suggestion,omitempty"` } // RunnerMatch represents job-to-runner matching result type RunnerMatch struct { Job string `json:"job"` RunsOn []string `json:"runs_on"` MatchedRunners []string `json:"matched_runners,omitempty"` CapabilitiesMet bool `json:"capabilities_met"` } // WorkflowValidationResponse is the response for workflow validation type WorkflowValidationResponse struct { Valid bool `json:"valid"` Warnings []*WorkflowValidationWarning `json:"warnings,omitempty"` RunnerMatch []*RunnerMatch `json:"runner_match,omitempty"` }