* chore(pre-commit): add pre-commit hook to enforce code style - Added husky for managing Git hooks and lint-staged for pre-commit checks. - Updated prettier version to 3.5.3. - Configured lint-staged to format and lint JavaScript and JSON files before commits. * chore(workflows): add lint check to CI * fix: version not correct * chore(workflow): bump GitHub Actions dependencies to latest versions - @actions/setup-node: v3 -> v4 - @actions/cache: v3 -> v4 - @actions/upload-artifact: v3 -> v4 --------- Co-authored-by: 亢奋猫 <kangfenmao@qq.com>
47 lines
1.0 KiB
YAML
47 lines
1.0 KiB
YAML
name: Pull Request CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install corepack
|
|
run: corepack enable && corepack prepare yarn@4.6.0 --activate
|
|
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache yarn dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
node_modules
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
|
|
- name: Install Dependencies
|
|
run: yarn install
|
|
|
|
- name: Build Check
|
|
run: yarn build:check
|
|
|
|
- name: Lint Check
|
|
run: yarn lint
|