05-Generate READMEs #60
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: '05-Generate READMEs' | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - 'repos.yml' | |
| branches: | |
| - main | |
| workflow_run: | |
| workflows: ["03-Classify Repos"] | |
| types: | |
| - completed | |
| permissions: | |
| contents: write | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate Content | |
| run: node scripts/generate-readmes.cjs | |
| - name: Commit changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add README.md categories/ tags/ | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "docs: generate READMEs [skip ci]" | |
| for i in 1 2 3 4 5; do | |
| git pull --rebase --autostash origin main | |
| git push && break || sleep 10 | |
| done | |
| fi |