generate-readme #389
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: generate-readme | |
| on: | |
| schedule: | |
| - cron: '0 5 * * 1' | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| jobs: | |
| cron: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: latest | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: latest | |
| run_install: true | |
| - name: Generate README.md | |
| run: | | |
| pnpm generate | |
| env: | |
| # note: GITHUB_TOKEN doesn't seem to work due to permissions | |
| USER_TOKEN: ${{ secrets.USER_TOKEN }} | |
| - name: Commit changes if any | |
| # https://github.com/actions/checkout/pull/1184 | |
| run: | | |
| [ -z "$(git status --porcelain | grep README.md)" ] && exit | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add README.md | |
| git commit -m "Update README.md" | |
| git push |