Skip to content

Commit

Permalink
chore: automate reordering of datasets.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
mariagrandury committed Jul 27, 2023
1 parent 3a2ca3c commit 5ea5d85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/readme-generation.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Generate README on datasets.csv file update

on:
push:
pull_request:
branches:
- main
paths:
Expand All @@ -24,6 +24,7 @@ jobs:
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add README.md
git commit -m "Update datasets table"
git push https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:main
git add datasets.csv README.md
git commit -m "Update datasets table and reorder datasets.csv"
git push origin "${{ github.head_ref }}"
6 changes: 6 additions & 0 deletions generate_datasets_table.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import pandas as pd

df = pd.read_csv("datasets.csv")

# Sort the DataFrame by the 'name' column and save it
df.sort_values(by="name", inplace=True)
df.to_csv("datasets.csv", index=False)

# Generate the datasets table
table_content = df.to_markdown(index=False)

with open("README.md", "r") as f:
Expand Down

0 comments on commit 5ea5d85

Please sign in to comment.