Skip to content

Commit 9e1434d

Browse files
authored
Readme Gen
1 parent 79fe813 commit 9e1434d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/main.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Generate README
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
generate-readme:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Generate README
13+
env:
14+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
15+
run: |
16+
pip install openai
17+
python - <<'EOF'
18+
import os, openai
19+
20+
files = [f for f in os.listdir('.') if os.path.isfile(f)]
21+
prompt = f"Generate a professional README.md for a project containing these files: {files}"
22+
response = openai.ChatCompletion.create(
23+
model="gpt-4o-mini",
24+
messages=[{"role": "user", "content": prompt}]
25+
)
26+
with open("README.md", "w") as f:
27+
f.write(response.choices[0].message["content"])
28+
EOF
29+
- name: Commit and push README
30+
run: |
31+
git config user.name "github-actions"
32+
git config user.email "actions@github.com"
33+
git add README.md
34+
git commit -m "Auto-generated README"
35+
git push

0 commit comments

Comments
 (0)