diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml deleted file mode 100644 index 4613569..0000000 --- a/.github/workflows/label.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This workflow will triage pull requests and apply a label based on the -# paths that are modified in the pull request. -# -# To use this workflow, you will need to set up a .github/labeler.yml -# file with configuration. For more information, see: -# https://github.com/actions/labeler - -name: Labeler -on: [pull_request_target] - -jobs: - label: - - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - - steps: - - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000..3dd4348 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,53 @@ +name: Code Quality Checks + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + lint: + name: Run Linters + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # 安装 Node.js + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + # 安装并运行 HTMLHint + - name: Install and Run HTMLHint + run: | + npm install htmlhint --save-dev + npx htmlhint "**/*.html" --config .htmlhintrc + + # 安装 Stylelint + - name: Install Stylelint + run: | + npm init -y + npm install stylelint stylelint-config-standard --save-dev + # 创建基础配置(如果还没有) + - name: Create default .stylelintrc.json + run: | + echo '{ + "extends": "stylelint-config-standard" + }' > .stylelintrc.json + if: ${{ !hashFiles('.stylelintrc.json') }} + + # 执行 Stylelint + - name: Run Stylelint + run: npx stylelint "**/*.css" + + check-size: + name: Check Bundle Size + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: andresz1/size-limit-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.htmlhintrc b/.htmlhintrc new file mode 100644 index 0000000..223da32 --- /dev/null +++ b/.htmlhintrc @@ -0,0 +1,22 @@ +{ + "tagname-lowercase": true, + "attr-lowercase": true, + "attr-value-double-quotes": true, + "attr-value-not-empty": true, + "attr-no-duplication": true, + "doctype-first": true, + "tag-pair": true, + "tag-self-close": true, + "spec-char-escape": true, + "id-unique": true, + "src-not-empty": true, + "title-require": true, + "alt-require": true, + "doctype-html5": true, + "style-disabled": true, + "inline-style-disabled": true, + "inline-script-disabled": true, + "space-tab-mixed-disabled": "space", + "id-class-ad-disabled": true, + "href-abs-or-rel": false +} diff --git a/size.yml b/size.yml deleted file mode 100644 index 8ac2199..0000000 --- a/size.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: Check Bundle Size - -on: [pull_request] - -jobs: - check-size: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: andresz1/size-limit-action@v1