fix: Resolve all linter issues
- Use modules/json instead of encoding/json (depguard) - Rename 'cap' variable to avoid shadowing builtin (revive) - Simplify conditional assignment (staticcheck) - Fix gofmt formatting issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ada0024b09
commit
75ee700ff2
@ -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"`
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user