From c39e4b7113cc7b52e13fe1e243a7a8addb56b473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Sun, 13 Jul 2025 18:01:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9Ruff=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=E4=BB=A5=E4=BD=BF=E7=94=A8=E8=87=AA=E6=89=98?= =?UTF-8?q?=E7=AE=A1=E8=BF=90=E8=A1=8C=E7=8E=AF=E5=A2=83=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=8F=90=E4=BA=A4=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ruff.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 50dd21d0d..f3844b547 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -13,7 +13,7 @@ permissions: jobs: ruff: - runs-on: ubuntu-latest + runs-on: self-hosted # 关键修改:添加条件判断 # 确保只有在 event_name 是 'push' 且不是由 Pull Request 引起的 push 时才运行 if: github.event_name == 'push' && !startsWith(github.ref, 'refs/pull/') @@ -29,14 +29,20 @@ jobs: args: "--version" version: "latest" - name: Run Ruff Fix - run: ruff check --fix --unsafe-fixes || true + run: ruff check --fix --unsafe-fixes; if ($LASTEXITCODE -ne 0) { Write-Host "Ruff check completed with warnings" } + shell: pwsh - name: Run Ruff Format - run: ruff format || true + run: ruff format; if ($LASTEXITCODE -ne 0) { Write-Host "Ruff format completed with warnings" } + shell: pwsh - name: 提交更改 if: success() run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add -A - git diff --quiet && git diff --staged --quiet || git commit -m "🤖 自动格式化代码 [skip ci]" - git push + $changes = git diff --quiet; $staged = git diff --staged --quiet + if (-not ($changes -and $staged)) { + git commit -m "🤖 自动格式化代码 [skip ci]" + git push + } + shell: pwsh From ec80b87f6a7c380ea20bdc916aa10b034cbabdad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Sun, 13 Jul 2025 18:06:03 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E4=BB=A5=E4=BD=BF=E7=94=A8=E8=87=AA=E6=89=98=E7=AE=A1?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=B9=B6=E4=BC=98=E5=8C=96=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=92=8CRuff=E6=A3=80=E6=9F=A5=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/precheck.yml | 27 +++++++++++++++++++-------- .github/workflows/ruff-pr.yml | 18 +++++++++++++++--- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/precheck.yml b/.github/workflows/precheck.yml index a7524ccb3..d7264c703 100644 --- a/.github/workflows/precheck.yml +++ b/.github/workflows/precheck.yml @@ -4,21 +4,32 @@ on: [pull_request] jobs: conflict-check: - runs-on: ubuntu-latest + runs-on: self-hosted + outputs: + conflict: ${{ steps.check-conflicts.outputs.conflict }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Check Conflicts + id: check-conflicts run: | git fetch origin main - if git diff --name-only --diff-filter=U origin/main...HEAD | grep .; then - echo "CONFLICT=true" >> $GITHUB_ENV - fi + $conflicts = git diff --name-only --diff-filter=U origin/main...HEAD + if ($conflicts) { + echo "conflict=true" >> $env:GITHUB_OUTPUT + Write-Host "Conflicts detected in files: $conflicts" + } else { + echo "conflict=false" >> $env:GITHUB_OUTPUT + Write-Host "No conflicts detected" + } + shell: pwsh labeler: - runs-on: ubuntu-latest + runs-on: self-hosted needs: conflict-check + if: needs.conflict-check.outputs.conflict == 'true' steps: - - uses: actions/github-script@v6 - if: env.CONFLICT == 'true' + - uses: actions/github-script@v7 with: script: | github.rest.issues.addLabels({ diff --git a/.github/workflows/ruff-pr.yml b/.github/workflows/ruff-pr.yml index bb83de8c9..552efbb89 100644 --- a/.github/workflows/ruff-pr.yml +++ b/.github/workflows/ruff-pr.yml @@ -1,9 +1,21 @@ -name: Ruff +name: Ruff PR Check on: [ pull_request ] jobs: ruff: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v4 - - uses: astral-sh/ruff-action@v3 + with: + fetch-depth: 0 + - name: Install Ruff and Run Checks + uses: astral-sh/ruff-action@v3 + with: + args: "--version" + version: "latest" + - name: Run Ruff Check (No Fix) + run: ruff check --output-format=github + shell: pwsh + - name: Run Ruff Format Check + run: ruff format --check --diff + shell: pwsh From e1433f7cfc406adddee2908408aa74f9520d5810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Sun, 13 Jul 2025 18:15:51 +0800 Subject: [PATCH 3/3] test actions --- src/chat/emoji_system/emoji_manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chat/emoji_system/emoji_manager.py b/src/chat/emoji_system/emoji_manager.py index 11fb0f62d..578ff0172 100644 --- a/src/chat/emoji_system/emoji_manager.py +++ b/src/chat/emoji_system/emoji_manager.py @@ -12,6 +12,7 @@ from typing import Optional, Tuple, List, Any from PIL import Image from rich.traceback import install + from src.common.database.database_model import Emoji from src.common.database.database import db as peewee_db from src.common.logger import get_logger