@@ -2,31 +2,52 @@ name: Auto Generate Project README
22
33on :
44 push :
5- paths :
6- - " */" # Detect new folders
7- - " !**/README.md"
5+ # trigger on any push except changes in .github to avoid recursion
6+ paths-ignore :
7+ - ' .github/**'
8+ workflow_dispatch : {} # allow manual run from Actions UI
9+
10+ permissions :
11+ contents : write # allow the action to commit back
812
913jobs :
1014 generate-readme :
1115 runs-on : ubuntu-latest
1216
1317 steps :
14- - name : Checkout repo
15- uses : actions/checkout@v3
18+ - name : Checkout repository
19+ uses : actions/checkout@v4
20+ with :
21+ fetch-depth : 0
22+ persist-credentials : true
1623
17- - name : Set up Python
24+ - name : Setup Python
1825 uses : actions/setup-python@v4
1926 with :
20- python-version : " 3.x"
27+ python-version : ' 3.x'
2128
22- - name : Run script
29+ - name : Show recent changes (for debugging)
2330 run : |
24- python .github/scripts/generate_readme.py
31+ echo "Actor: ${{ github.actor }}"
32+ echo "Ref: ${{ github.ref }}"
33+ echo "Commit: ${{ github.sha }}"
34+ echo "Last changed files:"
35+ git --no-pager diff --name-only ${{ github.sha }} ${{ github.sha }}^ || true
36+ ls -la
37+
38+ - name : Run README generator
39+ run : python .github/scripts/generate_readme.py
2540
26- - name : Commit changes
41+ - name : Commit and push generated README files
42+ env :
43+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2744 run : |
28- git config --global user.name "ml-bot"
29- git config --global user.email "ml-bot@users.noreply.github.com"
30- git add .
31- git commit -m "🤖 Auto-generate README for new project"
32- git push
45+ git config user.name "ml-bot"
46+ git config user.email "ml-bot@users.noreply.github.com"
47+ git add -A
48+ if git diff --staged --quiet; then
49+ echo "No changes to commit."
50+ else
51+ git commit -m "🤖 Auto-generate README for new projects"
52+ git push
53+ fi
0 commit comments