Skip to content

Commit 2d57d15

Browse files
committed
Add GH action: auto review PRs for lint/format problems
- Run workflow on PRs only to avoid duplicated actions - Combine all checks into one workflow Issue #2096
1 parent 73f8d19 commit 2d57d15

File tree

2 files changed

+52
-35
lines changed

2 files changed

+52
-35
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'Format, Lint, & Test'
2+
'on':
3+
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
branches-ignore:
9+
- ignore-*
10+
jobs:
11+
run_checks:
12+
name: Run All Checks
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
steps:
18+
- name: Check out code
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '18'
26+
- name: Install dependencies
27+
run: npm install
28+
- name: Check for linting errors on changed code
29+
uses: reviewdog/action-eslint@v1
30+
if: always()
31+
with:
32+
github_token: '${{ secrets.GITHUB_TOKEN }}'
33+
reporter: github-pr-review
34+
eslint_flags: src
35+
filter_mode: diff_context
36+
fail_on_error: true
37+
- name: Check for formatting errors on changed code
38+
uses: EPMatt/reviewdog-action-prettier@v1
39+
if: always()
40+
with:
41+
github_token: '${{ secrets.GITHUB_TOKEN }}'
42+
reporter: github-pr-review
43+
filter_mode: diff_context
44+
fail_on_error: true
45+
- name: Ensure unit tests pass
46+
id: test
47+
if: always()
48+
run: npm test
49+
- name: Ensure docs build without errors
50+
id: jsdoc-dry-run
51+
if: always()
52+
run: npm run jsdoc-dry-run

.github/workflows/test.js.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)