Skip to content
Closed
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
6 changes: 3 additions & 3 deletions pkg/cli/actionlint.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ func runActionlintOnFile(lockFiles []string, verbose bool, strict bool) error {
}

// Get relative paths from git root for all files
var relPaths []string
for _, lockFile := range lockFiles {
relPaths := make([]string, len(lockFiles))
for i, lockFile := range lockFiles {
relPath, err := filepath.Rel(gitRoot, lockFile)
if err != nil {
return fmt.Errorf("failed to get relative path for %s: %w", lockFile, err)
}
relPaths = append(relPaths, relPath)
relPaths[i] = relPath
}

// Build the Docker command with JSON output for easier parsing
Expand Down
11 changes: 5 additions & 6 deletions pkg/cli/actions_build_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/github/gh-aw/pkg/console"
"github.com/github/gh-aw/pkg/logger"
"github.com/github/gh-aw/pkg/sliceutil"
"github.com/github/gh-aw/pkg/workflow"
)

Expand Down Expand Up @@ -136,12 +137,10 @@ func getActionDirectories(actionsDir string) ([]string, error) {
return nil, fmt.Errorf("failed to read actions directory: %w", err)
}

var dirs []string
for _, entry := range entries {
if entry.IsDir() {
dirs = append(dirs, entry.Name())
}
}
dirs := sliceutil.FilterMap(entries,
func(entry os.DirEntry) bool { return entry.IsDir() },
func(entry os.DirEntry) string { return entry.Name() },
)

sort.Strings(dirs)
return dirs, nil
Expand Down
10 changes: 5 additions & 5 deletions pkg/cli/add_workflow_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/github/gh-aw/pkg/console"
"github.com/github/gh-aw/pkg/logger"
"github.com/github/gh-aw/pkg/sliceutil"
)

var addWorkflowPRLog = logger.New("cli:add_workflow_pr")
Expand Down Expand Up @@ -81,11 +82,10 @@ func addWorkflowsWithPR(workflows []*WorkflowSpec, number int, verbose bool, qui
prTitle = fmt.Sprintf("Add agentic workflow %s", joinedNames)
prBody = fmt.Sprintf("Add agentic workflow %s", joinedNames)
} else {
// Get workflow.Workflo
workflowNames := make([]string, len(workflows))
for i, wf := range workflows {
workflowNames[i] = wf.WorkflowName
}
// Extract workflow names using functional approach
workflowNames := sliceutil.Map(workflows, func(wf *WorkflowSpec) string {
return wf.WorkflowName
})
joinedNames = strings.Join(workflowNames, ", ")
commitMessage = fmt.Sprintf("Add agentic workflows: %s", joinedNames)
prTitle = fmt.Sprintf("Add agentic workflows: %s", joinedNames)
Expand Down