Skip to content

Commit

Permalink
feat(backend): Support README files in the docs directory
Browse files Browse the repository at this point in the history
Many other Git platforms support it as well.
  • Loading branch information
5ouma committed Jan 15, 2025
1 parent 22d00e9 commit dc0fab6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/backend/utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package backend

import (
"fmt"

"github.com/charmbracelet/soft-serve/git"
"github.com/charmbracelet/soft-serve/pkg/proto"
)
Expand All @@ -19,5 +21,9 @@ func LatestFile(r proto.Repository, ref *git.Reference, pattern string) (string,
func Readme(r proto.Repository, ref *git.Reference) (readme string, path string, err error) {
pattern := "[rR][eE][aA][dD][mM][eE]*"
readme, path, err = LatestFile(r, ref, pattern)
if err != nil {
pattern := fmt.Sprintf("docs/%s", pattern)
readme, path, err = LatestFile(r, ref, pattern)
}
return
}

0 comments on commit dc0fab6

Please sign in to comment.