console/.github/workflows/lint.yaml
2023-03-14 16:12:50 +01:00

70 lines
1.8 KiB
YAML

on:
workflow_call:
jobs:
eslint-and-prettier:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: setup environment
uses: ./.github/actions/setup
with:
actor: lint
- name: lint .env.template files
run: pnpm lint:env-template
- name: eslint cache
uses: actions/cache@v3
with:
path: '.eslintcache'
key: ${{ runner.os }}-eslint-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-eslint
- name: Cache ESLint and Prettier
uses: actions/cache@v3
with:
path: |
.eslintcache
node_modules/.cache/prettier
key: lint-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.sha }}
restore-keys: |
lint-cache-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: eslint
id: eslint
run: pnpm lint
env:
TIMING: 'true'
DEBUG: 'eslint:cli-engine'
- name: eslint tip
if: ${{ steps.eslint.outcome }} == 'failure'
run: echo "Run pnpm lint --fix"
- name: prettier
id: prettier
run: pnpm lint:prettier
- name: eslint tip
if: ${{ steps.prettier.outcome }} == 'failure'
run: echo "Run pnpm format"
- name: Generate Types
run: yarn graphql:generate
- name: Operation Check
run: |
npx graphql-inspector validate \
"packages/web/app/**/*.graphql|packages/libraries/cli/**/*.graphql|packages/web/app/**/*.tsx|packages/web/app/src/lib/**/*.ts" \
"packages/**/module.graphql.ts" \
--maxDepth=20 \
--maxAliasCount=20 \
--maxDirectiveCount=20 \
--maxTokenCount=800