File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments