Auto Generate Project README #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Generate Project README | |
| on: | |
| push: | |
| # trigger on any push except changes in .github to avoid recursion | |
| paths-ignore: | |
| - '.github/**' | |
| workflow_dispatch: {} # allow manual run from Actions UI | |
| permissions: | |
| contents: write # allow the action to commit back | |
| jobs: | |
| generate-readme: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Show recent changes (for debugging) | |
| run: | | |
| echo "Actor: ${{ github.actor }}" | |
| echo "Ref: ${{ github.ref }}" | |
| echo "Commit: ${{ github.sha }}" | |
| echo "Last changed files:" | |
| git --no-pager diff --name-only ${{ github.sha }} ${{ github.sha }}^ || true | |
| ls -la | |
| - name: Run README generator | |
| run: python .github/scripts/generate_readme.py | |
| - name: Commit and push generated README files | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "ml-bot" | |
| git config user.email "ml-bot@users.noreply.github.com" | |
| git add -A | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit." | |
| else | |
| git commit -m "🤖 Auto-generate README for new projects" | |
| git push | |
| fi |