mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
name: Lint & Format
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
- 'master'
|
|
- 'develop'
|
|
- 'hotfix/**'
|
|
- 'release/**'
|
|
pull_request:
|
|
branches:
|
|
- 'main'
|
|
- 'master'
|
|
- 'develop'
|
|
- 'hotfix/**'
|
|
- 'release/**'
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
code-quality:
|
|
name: Code Quality Check
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: [18.x, 20.x]
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run ESLint
|
|
run: npm run lint
|
|
|
|
- name: Check Prettier formatting
|
|
run: npm run format:check
|
|
|
|
- name: Comment PR (on failure)
|
|
if: failure() && github.event_name == 'pull_request'
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: '❌ **Code Quality Check Failed**\n\nPlease run `npm run code:fix` to fix linting and formatting issues, then commit the changes.'
|
|
})
|