Skip to content

Readme Gen

Readme Gen #1

Workflow file for this run

name: Generate README
on:
push:
branches:
- main
jobs:
generate-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate README
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
pip install openai
python - <<'EOF'
import os, openai
files = [f for f in os.listdir('.') if os.path.isfile(f)]
prompt = f"Generate a professional README.md for a project containing these files: {files}"
response = openai.ChatCompletion.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": prompt}]
)
with open("README.md", "w") as f:
f.write(response.choices[0].message["content"])
EOF
- name: Commit and push README
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git add README.md
git commit -m "Auto-generated README"
git push