name: Migration checks

on: workflow_dispatch

jobs:
  checks:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v3
      with:
        node-version-file: '.nvmrc'
    - run: npm ci --no-audit
    - run: result=$(find src -type f -iname '*.html' -exec sh -c 'cat {} | tr "\n" " " | grep -Eo "class=\"[^\"]+\"[^>]+class=\"" ' \; | wc -l); test $result -eq 0
    - run: npm install -D @ionic/v4-migration-tslint
    - run: npx tslint -c ionic-migration.json -p tsconfig.json