ci: add lint.yml workflow for PR check (#2253)
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
name: Lint Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Changed Files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v45
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.changed-files.outputs.any_changed == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install Dependencies
|
||||
if: steps.changed-files.outputs.any_changed == 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Run ESLint with Reviewdog
|
||||
if: steps.changed-files.outputs.any_changed == 'true'
|
||||
uses: reviewdog/action-eslint@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
reporter: github-pr-review
|
||||
eslint_flags: "${{ steps.changed-files.outputs.all_changed_files }}"
|
||||
filter_mode: diff_context
|
||||
fail_on_error: false
|
||||
|
||||
Reference in New Issue
Block a user