Skip to content

Auto Generate Project README #2

Auto Generate Project README

Auto Generate Project README #2

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@0ad4b8f736b64f5d0c8b0c9bdb40b24c2cfdd8e6
with:
fetch-depth: 0
persist-credentials: true
- name: Setup Python
uses: actions/setup-python@13b22673d2b3a8df47e6a9a2cba3f6468b8990c4
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