ci: WIP #1530
This file contains 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: Pre-Commit Formatting | |
on: | |
pull_request: | |
paths: | |
- 'client/**' | |
- 'frontend/**' | |
- 'backend/**' | |
- 'docs/_static/css/**' | |
- '.github/workflows/**' # Re-run if a workflow is modified - useful to test workflow changes in PRs | |
push: | |
branches: | |
- main | |
jobs: | |
pre-commit-checks: | |
name: pre-commit checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
frontend: | |
- 'frontend/**' | |
- uses: actions/setup-node@v3 | |
if: steps.changes.outputs.frontend == 'true' | |
with: | |
node-version: 20.8.x | |
- name: Install PNPM | |
if: steps.changes.outputs.frontend == 'true' | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 8.9.0 | |
run_install: false | |
- name: Get pnpm store directory | |
if: steps.changes.outputs.frontend == 'true' | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Setup pnpm cache | |
uses: actions/cache@v3 | |
if: steps.changes.outputs.frontend == 'true' | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies with PNPM | |
if: steps.changes.outputs.frontend == 'true' | |
run: pnpm install --frozen-lockfile | |
working-directory: frontend | |
- name: run pre-commit | |
if: steps.changes.outputs.frontend == 'true' | |
uses: pre-commit/[email protected] | |
- name: run pre-commit without pnpm | |
if: steps.changes.outputs.frontend != 'true' | |
uses: pre-commit/[email protected] | |
env: | |
SKIP: pnpm-lint |