gitea/modules/structs/actions_capabilities.go
logikonline fbd5da0acb
Some checks are pending
Build and Release / Lint and Test (push) Waiting to run
Build and Release / Build Binaries (amd64, darwin) (push) Blocked by required conditions
Build and Release / Build Binaries (amd64, linux) (push) Blocked by required conditions
Build and Release / Build Binaries (amd64, windows) (push) Blocked by required conditions
Build and Release / Build Binaries (arm64, darwin) (push) Blocked by required conditions
Build and Release / Build Binaries (arm64, linux) (push) Blocked by required conditions
Add AI-friendly enhancements: runner capabilities, release archive, action compatibility
- Add runner capability discovery API (v2) for AI tools to query before writing workflows
- Add release archive feature with filter toggle UI
- Add GitHub Actions compatibility layer with action aliasing
- Store runner capabilities JSON from act_runner Declare calls
- Add migrations for release archive and runner capabilities fields

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 04:56:11 -05:00

94 lines
3.7 KiB
Go

// 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"`
}