Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ jobs:
# Enforce selected production custom analyzers without blocking on unrelated
# legacy custom analyzer findings in tests or other analyzer families.
- name: Run custom linters
run: make golint-custom LINTER_FLAGS="-errstringmatch -panicinlibrarycode -manualmutexunlock -osexitinlibrary -rawloginlib -regexpcompileinfunction -fprintlnsprintf -strconvparseignorederror -jsonmarshalignoredeerror -uncheckedtypeassertion -fmterrorfnoverbs -test=false"
run: make golint-custom LINTER_FLAGS="-errstringmatch -panicinlibrarycode -manualmutexunlock -osexitinlibrary -rawloginlib -regexpcompileinfunction -fprintlnsprintf -strconvparseignorederror -jsonmarshalignoredeerror -uncheckedtypeassertion -fmterrorfnoverbs -tolowerequalfold -test=false"

# Ensure no action shell scripts invoke python or python3
- name: Lint action shell scripts
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/add_workflow_resolution.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func checkWorkflowHasDispatchFromContent(content string) bool {
return strings.Contains(strings.ToLower(on), "workflow_dispatch")
case []any:
for _, item := range on {
if str, ok := item.(string); ok && strings.ToLower(str) == "workflow_dispatch" {
if str, ok := item.(string); ok && strings.EqualFold(str, "workflow_dispatch") {
return true
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/codespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var codespaceLog = logger.New("cli:codespace")
// by checking for the CODESPACES environment variable
func isRunningInCodespace() bool {
// GitHub Codespaces sets CODESPACES=true environment variable
isCodespace := strings.ToLower(os.Getenv("CODESPACES")) == "true"
isCodespace := strings.EqualFold(os.Getenv("CODESPACES"), "true")
codespaceLog.Printf("Codespace detection: is_codespace=%v", isCodespace)
return isCodespace
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/cli/forecast.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,8 @@ func listRunsWithBackoff(ctx context.Context, opts ListWorkflowRunsOptions, work
// best matches id. Matching is tried against the file-based key (e.g. "ci-doctor") and the
// display name (e.g. "CI Failure Doctor"), both case-insensitively. Returns "" on no match.
func matchRemoteWorkflowName(id string, workflows map[string]*GitHubWorkflow) string {
lowerID := strings.ToLower(id)
for key, wf := range workflows {
if strings.ToLower(key) == lowerID || strings.ToLower(wf.Name) == lowerID {
if strings.EqualFold(key, id) || strings.EqualFold(wf.Name, id) {
return wf.Name
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/import_url_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func attachImportAuthHeader(req *http.Request, rawURL string) {
}

// Never send credentials over plaintext HTTP — HTTPS is required.
if strings.ToLower(parsed.Scheme) != "https" {
if !strings.EqualFold(parsed.Scheme, "https") {
importURLFetcherLog.Printf("Skipping auth header for non-HTTPS URL: scheme=%s", parsed.Scheme)
return
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/outcome_eval_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func evalAddReviewer(item CreatedItemReport, repoOverride string) OutcomeReport
var approvedReviewer string
var submittedReviewer string
for login, review := range latestByReviewer {
if strings.ToUpper(outcomeString(review["state"])) == "APPROVED" {
if strings.EqualFold(outcomeString(review["state"]), "APPROVED") {
approvedReviewer = login
break
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/parser/schema_suggestions.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ func findFieldLocationsInSchema(schemaDoc any, targetField, currentPath string)
}
seen[key] = true

if strings.ToLower(loc.FieldName) == targetLower {
if strings.EqualFold(loc.FieldName, targetField) {
loc.Distance = 0
exactMatches = append(exactMatches, loc)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/parser/yaml_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func isYAMLWorkflowFile(filePath string) bool {
func isActionDefinitionFile(filePath string, content []byte) (bool, error) {
// Quick check: action.yml or action.yaml filename
base := filepath.Base(filePath)
if strings.ToLower(base) == "action.yml" || strings.ToLower(base) == "action.yaml" {
if strings.EqualFold(base, "action.yml") || strings.EqualFold(base, "action.yaml") {
return true, nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/workflow/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func getFeatureValueFromFrontmatter(flagLower string, workflowData *WorkflowData
}

for key, value := range workflowData.Features {
if strings.ToLower(key) == flagLower {
if strings.EqualFold(key, flagLower) {
if enabled, found := parseFeatureValue(value); found {
if logEnabled {
featuresLog.Printf("Feature found in frontmatter (case-insensitive): %s=%v", flagLower, enabled)
Expand Down Expand Up @@ -102,7 +102,7 @@ func isFeatureInEnvironment(flagLower string, logEnabled bool) bool {
featuresLog.Printf("Checking GH_AW_FEATURES environment variable: %s", features)
}
for feature := range strings.SplitSeq(features, ",") {
if strings.ToLower(strings.TrimSpace(feature)) == flagLower {
if strings.EqualFold(strings.TrimSpace(feature), flagLower) {
return true
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/notify_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ func isGroupConcurrencyQueueEnabled(data *WorkflowData) bool {
flag := strings.ToLower(strings.TrimSpace(string(constants.GroupConcurrencyQueueFeatureFlag)))
if data != nil && data.Features != nil {
for key, value := range data.Features {
if strings.ToLower(key) == flag {
if strings.EqualFold(key, flag) {
return parseGroupConcurrencyQueueFeatureValue(value)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/repo_memory_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func validateBranchPrefix(prefix string) error {
}

// Cannot be "copilot"
if strings.ToLower(prefix) == "copilot" {
if strings.EqualFold(prefix, "copilot") {
return errors.New("branch-prefix cannot be 'copilot' (reserved)")
}

Expand Down
10 changes: 3 additions & 7 deletions pkg/workflow/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ func FindWorkflowName(input string) (string, error) {

// Normalize input for matching
normalizedInput := stringutil.NormalizeWorkflowName(input)
lowerInput := strings.ToLower(input)
lowerNormalizedInput := strings.ToLower(normalizedInput)

// Strategy 2: Try exact match with workflow ID (case-sensitive)
for _, wf := range workflows {
if wf.WorkflowID == input || wf.WorkflowID == normalizedInput {
Expand All @@ -170,7 +167,7 @@ func FindWorkflowName(input string) (string, error) {

// Strategy 3: Try case-insensitive match with workflow ID
for _, wf := range workflows {
if strings.ToLower(wf.WorkflowID) == lowerInput || strings.ToLower(wf.WorkflowID) == lowerNormalizedInput {
if strings.EqualFold(wf.WorkflowID, input) || strings.EqualFold(wf.WorkflowID, normalizedInput) {
resolveLog.Printf("Found case-insensitive workflow ID match: %s -> %s", input, wf.DisplayName)
return wf.DisplayName, nil
}
Expand All @@ -186,7 +183,7 @@ func FindWorkflowName(input string) (string, error) {

// Strategy 5: Try case-insensitive match with display name
for _, wf := range workflows {
if strings.ToLower(wf.DisplayName) == lowerInput {
if strings.EqualFold(wf.DisplayName, input) {
resolveLog.Printf("Found case-insensitive display name match: %s -> %s", input, wf.DisplayName)
return wf.DisplayName, nil
}
Expand Down Expand Up @@ -222,9 +219,8 @@ func GetWorkflowLockFileName(input string) (string, error) {
return "", fmt.Errorf("failed to get workflows: %w", err)
}

lowerInput := strings.ToLower(input)
for _, wf := range workflows {
if strings.ToLower(wf.DisplayName) == lowerInput {
if strings.EqualFold(wf.DisplayName, input) {
return wf.WorkflowID + ".lock.yml", nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func PrettifyToolName(toolName string) string {
}

// Handle bash specially - keep as "bash"
if strings.ToLower(toolName) == "bash" {
if strings.EqualFold(toolName, "bash") {
return "bash"
}

Expand Down
Loading