name: Validate JS on: push: branches: - main paths: - '.github/workflows/validate-js.yml' - 'src/**' - '*.json' - '*.js' - '*.lock' pull_request: paths: - '.github/workflows/validate-js.yml' - 'src/**' - '*.json' - '*.js' - '*.lock' jobs: compile: name: Compile JS (tsc) runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install reviewdog uses: reviewdog/action-setup@v1 - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - name: Restore node_modules from cache uses: actions/cache@v2 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - name: Install node_modules run: yarn install --frozen-lockfile - name: Install node_modules (example/) run: yarn install --frozen-lockfile --cwd example - name: Run TypeScript # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m run: | yarn typescript | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} lint: name: Lint JS (eslint, prettier) runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - name: Restore node_modules from cache uses: actions/cache@v2 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - name: Install node_modules run: yarn install --frozen-lockfile - name: Install node_modules (example/) run: yarn install --frozen-lockfile --cwd example - name: Run ESLint run: yarn lint -f @jamesacarr/github-actions