Skip to content

Commit

Permalink
Update generate_markdown_list.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
diegovelezg authored Jul 3, 2024
1 parent 59de24a commit 7ba61ec
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions .github/workflows/generate_markdown_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ name: Generate Markdown List
on:
push:
branches:
- main # la rama que corresponda
- main # la rama que corresp

jobs:
generate-list:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'

Expand All @@ -25,30 +25,32 @@ jobs:
- name: Generate markdown files list
run: |
import os
import yaml
import json
import pandas as pd
echo "import os
import yaml
import json
import pandas as pd

repo_path = '.'
repo_path = '.'

markdown_files = []
markdown_files = []

for root, dirs, files in os.walk(repo_path):
for file in files:
if file.endswith('.md'):
full_path = os.path.join(root, file)
relative_path = os.path.relpath(full_path, repo_path)
markdown_files.append(relative_path)
for root, dirs, files in os.walk(repo_path):
for file in files:
if file.endswith('.md'):
full_path = os.path.join(root, file)
relative_path = os.path.relpath(full_path, repo_path)
markdown_files.append(relative_path)

with open('markdown_files.yaml', 'w') as yaml_file:
yaml.dump(markdown_files, yaml_file)
with open('markdown_files.yaml', 'w') as yaml_file:
yaml.dump(markdown_files, yaml_file)

with open('markdown_files.json', 'w') as json_file:
json.dump(markdown_files, json_file, indent=4)
with open('markdown_files.json', 'w') as json_file:
json.dump(markdown_files, json_file, indent=4)

df = pd.DataFrame(markdown_files, columns=['Path'])
df.to_csv('markdown_files.csv', index=False)
df = pd.DataFrame(markdown_files, columns=['Path'])
df.to_csv('markdown_files.csv', index=False)
" > script.py
python script.py
- name: Commit and push changes
run: |
Expand All @@ -59,3 +61,4 @@ jobs:
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7ba61ec

Please sign in to comment.