f051481010
* Use reviewdog for TSC * Replace all `type Readonly<T>` with `interface T` * Use --frozen-lockfile for yarn * Give all actions a name * Fix yarn example
66 lines
1.6 KiB
YAML
66 lines
1.6 KiB
YAML
name: Validate JS
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- '.github/workflows/validate-js.yml'
|
|
- 'src/**'
|
|
- '*.js'
|
|
- '*.json'
|
|
- 'package.json'
|
|
- 'tsconfig.json'
|
|
- '.prettierrc.js'
|
|
- '.eslintrc.js'
|
|
- 'babel.config.js'
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/validate-js.yml'
|
|
- 'src/**'
|
|
- '*.js'
|
|
- '*.json'
|
|
- 'package.json'
|
|
- 'tsconfig.json'
|
|
- '.prettierrc.js'
|
|
- '.eslintrc.js'
|
|
- 'babel.config.js'
|
|
|
|
jobs:
|
|
vibe_check:
|
|
name: Validate JS (tsc, eslint, prettier)
|
|
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
|
|
run: yarn typescript | reviewdog -f=tsc -reporter=github-pr-review
|
|
env:
|
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run ESLint
|
|
uses: reviewdog/action-eslint@v1
|
|
with:
|
|
reporter: github-pr-review
|
|
eslint_flags: '--ext .js,.ts,.jsx,.tsx src'
|