diff --git a/.github/workflows/check-js.yml b/.github/workflows/check-js.yml new file mode 100644 index 00000000..77839789 --- /dev/null +++ b/.github/workflows/check-js.yml @@ -0,0 +1,62 @@ +name: Check JS + +on: + push: + branches: + - master + paths: + - '.github/workflows/check-js.yml' + - 'src/**' + - '*.json' + - '*.js' + - '*.jsx' + - '*.ts' + - '*.tsx' + - '*.lock' + pull_request: + paths: + - '.github/workflows/check-js.yml' + - 'src/**' + - '*.json' + - '*.js' + - '*.jsx' + - '*.ts' + - '*.tsx' + - '*.lock' + +jobs: + TypeScript-Check: + name: Check TS (tsc) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install node_modules + uses: ./.github/actions/setup-node + + - name: Install reviewdog + uses: reviewdog/action-setup@v1 + + - name: Check TypeScript + run: | + yarn tsc | 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 }} + + JS-Lint: + name: Lint JS (eslint, prettier) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install node_modules + uses: ./.github/actions/setup-node + + - name: Run ESLint + run: yarn lint -f @jamesacarr/github-actions + + - name: Run ESLint with auto-fix + run: yarn lint --fix + + - name: Verify no files have changed after auto-fix + run: git diff --exit-code HEAD \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 4f0b43f3..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: ci -on: [push, pull_request] -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18.x - - run: yarn --no-lockfile - - run: yarn lint diff --git a/package.json b/package.json index f1438196..8ce94e93 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@types/react": "~18.0.0" }, "devDependencies": { + "@jamesacarr/eslint-formatter-github-actions": "^0.2.0", "@react-native/eslint-config": "^0.72.2", "@release-it/conventional-changelog": "^7.0.2", "@types/jest": "^28.1.2",