Skip to content

Merge pull request #6 from codewithme-py/feat/longest-substring-witho… #20

Merge pull request #6 from codewithme-py/feat/longest-substring-witho…

Merge pull request #6 from codewithme-py/feat/longest-substring-witho… #20

Workflow file for this run

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: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -e .[dev]
- name: Run Ruff linter
run: ruff check .
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -e .[dev]
- name: Run tests
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: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -e .[dev]
- name: Generate README
run: python 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