From 7acee94ee4b89cbf3770cbbabd92795e5f25c60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Wed, 21 May 2025 22:50:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20Ruff=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=EF=BC=8C=E4=BB=85=E5=9C=A8=E5=AF=B9=E5=88=86?= =?UTF-8?q?=E6=94=AF=E7=9A=84push=E6=97=B6=E5=90=AF=E5=8A=A8Ruff=E6=A3=80?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ruff.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 58921a76f..ebc7027e1 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -1,5 +1,12 @@ name: Ruff -on: [ push ] + +on: + push: + branches: + - main + - dev + - dev-refactor # 例如:匹配所有以 feature/ 开头的分支 + # 添加你希望触发此 workflow 的其他分支 permissions: contents: write @@ -7,6 +14,10 @@ permissions: jobs: ruff: runs-on: ubuntu-latest + # 关键修改:添加条件判断 + # 确保只有在 event_name 是 'push' 且不是由 Pull Request 引起的 push 时才运行 + if: github.event_name == 'push' && !startsWith(github.ref, 'refs/pull/') + steps: - uses: actions/checkout@v4 with: @@ -25,5 +36,4 @@ jobs: 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 - + git push \ No newline at end of file