Merge pull request #13 from codewithme-py/feat/generate-parentheses-0022 #26
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-update README | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'solutions/*.py' | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python 3.10 | |
| run: uv python install 3.10 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run Ruff linter | |
| run: uv run ruff check . | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python 3.10 | |
| run: uv python install 3.10 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run tests | |
| run: uv run pytest | |
| update-readme: | |
| needs: [lint, test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GH_PAT }} | |
| persist-credentials: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python 3.10 | |
| run: uv python install 3.10 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Generate README | |
| run: uv run scripts/update_readme.py | |
| - name: Commit and push if changed | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add README.md | |
| if ! git diff --cached --quiet; then | |
| git commit -m "chore: auto-update README with latest solutions" | |
| git push | |
| else | |
| echo "No changes to README." | |
| fi |