Skip to content

Commit

Permalink
chore: use delimiters to generate readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mariagrandury committed Aug 28, 2023
1 parent cae2254 commit 53072ff
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/scripts/generate_datasets_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@
table_content = df.to_markdown(index=False)

with open("README.md", "r") as f:
readme_content = f.read()
readme_template = f.read()

updated_readme_content = readme_content.replace("<!-- TABLE_CONTENT -->", table_content)
start_delimiter = "<!-- START_TABLE_CONTENT -->"
end_delimiter = "<!-- END_TABLE_CONTENT -->"

start_pos = readme_template.find(start_delimiter)
end_pos = readme_template.find(end_delimiter)

updated_readme_content = (
readme_template[:start_pos + len(start_delimiter)]
+ "\n" + table_content + "\n"
+ readme_template[end_pos:]
)

with open("README.md", "w") as f:
f.write(updated_readme_content)

0 comments on commit 53072ff

Please sign in to comment.