Skip to content

fix: replace manual loop with slices.Contains in isValidWorkflowRunConclusion#29130

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-lint-go-job-failure
Apr 29, 2026
Merged

fix: replace manual loop with slices.Contains in isValidWorkflowRunConclusion#29130
pelikhan merged 2 commits intomainfrom
copilot/fix-lint-go-job-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

golangci-lint v2.8.0 introduced the modernize/slicescontains rule, which flagged a manual for-loop in isValidWorkflowRunConclusion that should use slices.Contains.

Changes

  • pkg/workflow/frontmatter_extraction_yaml.go: Replace manual loop with slices.Contains and add "slices" import
// Before
func isValidWorkflowRunConclusion(v string) bool {
    for _, valid := range validWorkflowRunConclusions {
        if v == valid {
            return true
        }
    }
    return false
}

// After
func isValidWorkflowRunConclusion(v string) bool {
    return slices.Contains(validWorkflowRunConclusions, v)
}

Copilot AI changed the title [WIP] Fix failing GitHub Actions job lint-go fix: replace manual loop with slices.Contains in isValidWorkflowRunConclusion Apr 29, 2026
Copilot AI requested a review from pelikhan April 29, 2026 14:35
@pelikhan pelikhan marked this pull request as ready for review April 29, 2026 14:36
Copilot AI review requested due to automatic review settings April 29, 2026 14:36
@pelikhan pelikhan merged commit f05fac2 into main Apr 29, 2026
19 checks passed
@pelikhan pelikhan deleted the copilot/fix-lint-go-job-failure branch April 29, 2026 14:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates isValidWorkflowRunConclusion to satisfy golangci-lint’s modernize/slicescontains by replacing a manual loop with slices.Contains.

Changes:

  • Add the standard library slices import.
  • Replace the manual for/if membership check in isValidWorkflowRunConclusion with slices.Contains.
Show a summary per file
File Description
pkg/workflow/frontmatter_extraction_yaml.go Uses slices.Contains for workflow run conclusion validation and adds the needed import.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants