name: Check Code with Prettier on: pull_request: branches: - 'master' # Cancel old builds on new commit for same workflow + branch/PR concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: format: runs-on: ubuntu-latest steps: - name: Check out repo uses: actions/checkout@v4 with: sparse-checkout: apps - name: Setup node uses: actions/setup-node@v3 with: node-version: 18 # Installing all dependencies takes up to three minutes, hacking around to only installing prettier+deps - name: Download dependencies run: | rm package.json rm package-lock.json npm i prettier@4.0.0-alpha.8 prettier-plugin-sql-cst - name: Run prettier run: |- npx prettier -c 'apps/**/*.{js,jsx,ts,tsx,css,md,mdx,json}' # i18n is not a node package, so we handle that one separately format-i18n: runs-on: ubuntu-latest steps: - name: Check out repo uses: actions/checkout@v4 with: sparse-checkout: | i18n - name: Setup node uses: actions/setup-node@v3 with: node-version: 18 # Installing all dependencies takes up to three minutes, hacking around to only installing prettier+deps - name: Download dependencies run: | rm package.json rm package-lock.json npm i prettier@4.0.0-alpha.8 prettier-plugin-sql-cst - name: Run prettier run: |- npx prettier -c 'i18n/**/*.{js,jsx,ts,tsx,css,md,mdx,json}' format-sql: runs-on: ubuntu-latest steps: - name: Check out repo uses: actions/checkout@v4 with: sparse-checkout: | apps/docs/pages apps/docs/content # Installing all dependencies takes up to three minutes, hacking around to only installing prettier+deps - name: Download dependencies run: | rm package.json rm package-lock.json npm i prettier@4.0.0-alpha.8 prettier-plugin-sql-cst - name: Run prettier run: |- # Check mdx files which contain sql code blocks grep -lr '```sql' apps/docs/{pages,content}/**/*.mdx | xargs npx prettier -c