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
|
// WorkflowHints provides hints for AI workflow generation
|
||||||
type WorkflowHints struct {
|
type WorkflowHints struct {
|
||||||
PreferredCheckout string `json:"preferred_checkout,omitempty"`
|
PreferredCheckout string `json:"preferred_checkout,omitempty"`
|
||||||
ArtifactUploadAlternative string `json:"artifact_upload_alternative,omitempty"`
|
ArtifactUploadAlternative string `json:"artifact_upload_alternative,omitempty"`
|
||||||
SecretAccess string `json:"secret_access,omitempty"`
|
SecretAccess string `json:"secret_access,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunnerWithCapabilities represents a runner with its capabilities for API response
|
// RunnerWithCapabilities represents a runner with its capabilities for API response
|
||||||
@ -87,7 +87,7 @@ type RunnerMatch struct {
|
|||||||
|
|
||||||
// WorkflowValidationResponse is the response for workflow validation
|
// WorkflowValidationResponse is the response for workflow validation
|
||||||
type WorkflowValidationResponse struct {
|
type WorkflowValidationResponse struct {
|
||||||
Valid bool `json:"valid"`
|
Valid bool `json:"valid"`
|
||||||
Warnings []*WorkflowValidationWarning `json:"warnings,omitempty"`
|
Warnings []*WorkflowValidationWarning `json:"warnings,omitempty"`
|
||||||
RunnerMatch []*RunnerMatch `json:"runner_match,omitempty"`
|
RunnerMatch []*RunnerMatch `json:"runner_match,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -156,10 +156,7 @@ func ListReleases(ctx *context.APIContext) {
|
|||||||
listOptions := utils.GetListOptions(ctx)
|
listOptions := utils.GetListOptions(ctx)
|
||||||
|
|
||||||
// By default, exclude archived releases unless explicitly requested
|
// By default, exclude archived releases unless explicitly requested
|
||||||
includeArchived := false
|
includeArchived := ctx.FormOptionalBool("archived").Has()
|
||||||
if ctx.FormOptionalBool("archived").Has() {
|
|
||||||
includeArchived = true
|
|
||||||
}
|
|
||||||
|
|
||||||
opts := repo_model.FindReleasesOptions{
|
opts := repo_model.FindReleasesOptions{
|
||||||
ListOptions: listOptions,
|
ListOptions: listOptions,
|
||||||
|
|||||||
@ -4,11 +4,11 @@
|
|||||||
package v2
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/actions"
|
|
||||||
actions_model "code.gitea.io/gitea/models/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"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
@ -80,9 +80,9 @@ func GetActionsCapabilities(ctx *context.APIContext) {
|
|||||||
|
|
||||||
// Parse capabilities JSON if available
|
// Parse capabilities JSON if available
|
||||||
if runner.CapabilitiesJSON != "" {
|
if runner.CapabilitiesJSON != "" {
|
||||||
var cap api.RunnerCapability
|
var runnerCaps api.RunnerCapability
|
||||||
if err := json.Unmarshal([]byte(runner.CapabilitiesJSON), &cap); err == nil {
|
if err := json.Unmarshal([]byte(runner.CapabilitiesJSON), &runnerCaps); err == nil {
|
||||||
runnerResp.Capabilities = &cap
|
runnerResp.Capabilities = &runnerCaps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ func GetActionsCapabilities(ctx *context.APIContext) {
|
|||||||
|
|
||||||
// inferCapabilitiesFromLabels attempts to infer capabilities from runner labels
|
// inferCapabilitiesFromLabels attempts to infer capabilities from runner labels
|
||||||
func inferCapabilitiesFromLabels(labels []string) *api.RunnerCapability {
|
func inferCapabilitiesFromLabels(labels []string) *api.RunnerCapability {
|
||||||
cap := &api.RunnerCapability{
|
caps := &api.RunnerCapability{
|
||||||
Limitations: []string{
|
Limitations: []string{
|
||||||
"Capabilities inferred from labels - may not be accurate",
|
"Capabilities inferred from labels - may not be accurate",
|
||||||
"actions/upload-artifact@v4 not supported (use v3 or direct API upload)",
|
"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 {
|
for _, label := range labels {
|
||||||
switch label {
|
switch label {
|
||||||
case "ubuntu-latest", "ubuntu-22.04", "ubuntu-20.04":
|
case "ubuntu-latest", "ubuntu-22.04", "ubuntu-20.04":
|
||||||
cap.OS = "linux"
|
caps.OS = "linux"
|
||||||
cap.Shell = []string{"bash", "sh"}
|
caps.Shell = []string{"bash", "sh"}
|
||||||
case "windows-latest", "windows-2022", "windows-2019":
|
case "windows-latest", "windows-2022", "windows-2019":
|
||||||
cap.OS = "windows"
|
caps.OS = "windows"
|
||||||
cap.Shell = []string{"pwsh", "powershell", "cmd"}
|
caps.Shell = []string{"pwsh", "powershell", "cmd"}
|
||||||
case "macos-latest", "macos-13", "macos-12":
|
case "macos-latest", "macos-13", "macos-12":
|
||||||
cap.OS = "darwin"
|
caps.OS = "darwin"
|
||||||
cap.Shell = []string{"bash", "sh", "zsh"}
|
caps.Shell = []string{"bash", "sh", "zsh"}
|
||||||
case "linux":
|
case "linux":
|
||||||
cap.OS = "linux"
|
caps.OS = "linux"
|
||||||
case "x64", "amd64":
|
case "x64", "amd64":
|
||||||
cap.Arch = "amd64"
|
caps.Arch = "amd64"
|
||||||
case "arm64", "aarch64":
|
case "arm64", "aarch64":
|
||||||
cap.Arch = "arm64"
|
caps.Arch = "arm64"
|
||||||
case "docker":
|
case "docker":
|
||||||
cap.Docker = true
|
caps.Docker = true
|
||||||
cap.ContainerRuntime = "docker"
|
caps.ContainerRuntime = "docker"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cap
|
return caps
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateWorkflow validates a workflow YAML and returns compatibility warnings
|
// ValidateWorkflow validates a workflow YAML and returns compatibility warnings
|
||||||
|
|||||||
@ -24,8 +24,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
access_model "code.gitea.io/gitea/models/perm/access"
|
|
||||||
auth_model "code.gitea.io/gitea/models/auth"
|
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"
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
apierrors "code.gitea.io/gitea/modules/errors"
|
apierrors "code.gitea.io/gitea/modules/errors"
|
||||||
|
|||||||
@ -4,13 +4,13 @@
|
|||||||
package actions
|
package actions
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
actions_model "code.gitea.io/gitea/models/actions"
|
actions_model "code.gitea.io/gitea/models/actions"
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
|
"code.gitea.io/gitea/modules/json"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/structs"
|
"code.gitea.io/gitea/modules/structs"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user