diff --git a/modules/actions/workflows.go b/modules/actions/workflows.go index 8ae38a8f26..c2a1544d32 100644 --- a/modules/actions/workflows.go +++ b/modules/actions/workflows.go @@ -32,16 +32,13 @@ func ListWorkflows(commit *git.Commit) (git.Entries, error) { return nil, err } - idx := 0 + ret := make(git.Entries, 0, len(entries)) for _, entry := range entries { - if !strings.HasSuffix(entry.Name(), ".yml") && !strings.HasSuffix(entry.Name(), ".yaml") { - continue + if strings.HasSuffix(entry.Name(), ".yml") || strings.HasSuffix(entry.Name(), ".yaml") { + ret = append(ret, entry) } - entries[idx] = entry - idx++ } - - return entries[:idx], nil + return ret, nil } func DetectWorkflows(commit *git.Commit, event webhook.HookEventType) (map[string][]byte, error) {