diff --git a/modules/structs/actions_capabilities.go b/modules/structs/actions_capabilities.go index caf2199c25..bcc489378a 100644 --- a/modules/structs/actions_capabilities.go +++ b/modules/structs/actions_capabilities.go @@ -42,9 +42,9 @@ type PlatformInfo struct { // 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"` + 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 @@ -87,7 +87,7 @@ type RunnerMatch struct { // 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"` + Valid bool `json:"valid"` + Warnings []*WorkflowValidationWarning `json:"warnings,omitempty"` + RunnerMatch []*RunnerMatch `json:"runner_match,omitempty"` } diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go index 33af68d5ea..d01a8dfbaa 100644 --- a/routers/api/v1/repo/release.go +++ b/routers/api/v1/repo/release.go @@ -156,10 +156,7 @@ func ListReleases(ctx *context.APIContext) { listOptions := utils.GetListOptions(ctx) // By default, exclude archived releases unless explicitly requested - includeArchived := false - if ctx.FormOptionalBool("archived").Has() { - includeArchived = true - } + includeArchived := ctx.FormOptionalBool("archived").Has() opts := repo_model.FindReleasesOptions{ ListOptions: listOptions, diff --git a/routers/api/v2/actions.go b/routers/api/v2/actions.go index 4b96abd059..35d0056f61 100644 --- a/routers/api/v2/actions.go +++ b/routers/api/v2/actions.go @@ -4,11 +4,11 @@ package v2 import ( - "encoding/json" "time" - "code.gitea.io/gitea/modules/actions" actions_model "code.gitea.io/gitea/models/actions" + "code.gitea.io/gitea/modules/actions" + "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/web" @@ -80,9 +80,9 @@ func GetActionsCapabilities(ctx *context.APIContext) { // Parse capabilities JSON if available if runner.CapabilitiesJSON != "" { - var cap api.RunnerCapability - if err := json.Unmarshal([]byte(runner.CapabilitiesJSON), &cap); err == nil { - runnerResp.Capabilities = &cap + var runnerCaps api.RunnerCapability + if err := json.Unmarshal([]byte(runner.CapabilitiesJSON), &runnerCaps); err == nil { + runnerResp.Capabilities = &runnerCaps } } @@ -99,7 +99,7 @@ func GetActionsCapabilities(ctx *context.APIContext) { // inferCapabilitiesFromLabels attempts to infer capabilities from runner labels func inferCapabilitiesFromLabels(labels []string) *api.RunnerCapability { - cap := &api.RunnerCapability{ + caps := &api.RunnerCapability{ Limitations: []string{ "Capabilities inferred from labels - may not be accurate", "actions/upload-artifact@v4 not supported (use v3 or direct API upload)", @@ -109,27 +109,27 @@ func inferCapabilitiesFromLabels(labels []string) *api.RunnerCapability { for _, label := range labels { switch label { case "ubuntu-latest", "ubuntu-22.04", "ubuntu-20.04": - cap.OS = "linux" - cap.Shell = []string{"bash", "sh"} + caps.OS = "linux" + caps.Shell = []string{"bash", "sh"} case "windows-latest", "windows-2022", "windows-2019": - cap.OS = "windows" - cap.Shell = []string{"pwsh", "powershell", "cmd"} + caps.OS = "windows" + caps.Shell = []string{"pwsh", "powershell", "cmd"} case "macos-latest", "macos-13", "macos-12": - cap.OS = "darwin" - cap.Shell = []string{"bash", "sh", "zsh"} + caps.OS = "darwin" + caps.Shell = []string{"bash", "sh", "zsh"} case "linux": - cap.OS = "linux" + caps.OS = "linux" case "x64", "amd64": - cap.Arch = "amd64" + caps.Arch = "amd64" case "arm64", "aarch64": - cap.Arch = "arm64" + caps.Arch = "arm64" case "docker": - cap.Docker = true - cap.ContainerRuntime = "docker" + caps.Docker = true + caps.ContainerRuntime = "docker" } } - return cap + return caps } // ValidateWorkflow validates a workflow YAML and returns compatibility warnings diff --git a/routers/api/v2/api.go b/routers/api/v2/api.go index 063c32a1da..2d84ee8f63 100644 --- a/routers/api/v2/api.go +++ b/routers/api/v2/api.go @@ -24,8 +24,8 @@ import ( "net/http" "strings" - access_model "code.gitea.io/gitea/models/perm/access" auth_model "code.gitea.io/gitea/models/auth" + access_model "code.gitea.io/gitea/models/perm/access" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" apierrors "code.gitea.io/gitea/modules/errors" diff --git a/routers/web/shared/actions/runners.go b/routers/web/shared/actions/runners.go index 4097a99e81..006830d3e7 100644 --- a/routers/web/shared/actions/runners.go +++ b/routers/web/shared/actions/runners.go @@ -4,13 +4,13 @@ package actions import ( - "encoding/json" "errors" "net/http" "net/url" actions_model "code.gitea.io/gitea/models/actions" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/structs"