mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-08 17:05:45 +02:00
chore: new way to trim entries
This commit is contained in:
parent
a222cb5c1e
commit
925f7f18f5
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user