Skip to content

Commit

Permalink
Handling README
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBger committed Mar 8, 2024
1 parent 683df19 commit 5ababc2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions manifest/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,24 @@ func (r *manifestConverter) manifestToPkg(manif *Manifest) (*pbsubstreams.Packag
func (r *manifestConverter) convertToPkg(m *Manifest) (pkg *pbsubstreams.Package, err error) {
doc := m.Package.Doc
if doc == "" {
readmePath := filepath.Join(m.Workdir, "README.md")
if _, err := os.Stat(readmePath); err == nil {
var readmePath string
if _, err := os.Stat(filepath.Join(m.Workdir, "README.md")); err == nil {
readmePath = filepath.Join(m.Workdir, "README.md")
content, err := os.ReadFile(readmePath)
if err != nil {
return nil, fmt.Errorf("failed to read README.md: %w", err)
}
doc = string(content)
}

if _, err := os.Stat(filepath.Join(m.Workdir, "README")); err == nil {
readmePath = filepath.Join(m.Workdir, "README")
content, err := os.ReadFile(readmePath)
if err != nil {
return nil, fmt.Errorf("failed to read README: %w", err)
}
doc = string(content)
}
}

pkgMeta := &pbsubstreams.PackageMetadata{
Expand Down

0 comments on commit 5ababc2

Please sign in to comment.