Skip to content

Commit

Permalink
Add GH action: auto review PRs for lint/format problems
Browse files Browse the repository at this point in the history
Issue #2096
  • Loading branch information
robyngit committed May 21, 2024
1 parent 0531eb0 commit 9825dc8
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint and Format Code Base

on:
pull_request:
paths:
- 'src/**/*.js'

jobs:
lint_and_format:
name: runner / eslint and prettier
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Important to fetch all history for diff

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: npm install

- name: Run ESLint with reviewdog
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
eslint_flags: 'src'
filter_mode: 'diff_context'

- name: Run Prettier with reviewdog
uses: EPMatt/reviewdog-action-prettier@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
prettier_flags: '--check src/**/*.js'
filter_mode: 'diff_context'

0 comments on commit 9825dc8

Please sign in to comment.