Skip to content

ci: add lint.yml workflow for PR check #6

ci: add lint.yml workflow for PR check

ci: add lint.yml workflow for PR check #6

Workflow file for this run

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
# BẮT BUỘC: Cấp quyền cho secrets.GITHUB_TOKEN để viết bình luận vào PR
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Dependencies
run: npm ci
# Thay vì chạy 'npm run lint', ta dùng reviewdog để chạy eslint
- name: Run ESLint with Reviewdog
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Đưa bình luận vào luồng thảo luận chính (Conversation tab)
reporter: github-pr-review
# Chạy eslint trên toàn bộ project (tương đương lệnh của bạn)
eslint_flags: "."
# Giữ là 'false' để nếu chỉ có WARNING thì GitHub vẫn hiện TÍCH XANH (Pass)
# Nếu muốn WARNING cũng làm X ĐỎ (Fail) thì đổi thành 'true'
fail_on_error: false