feat: 更新 Ruff 工作流,仅在对分支的push时启动Ruff检查
This commit is contained in:
16
.github/workflows/ruff.yml
vendored
16
.github/workflows/ruff.yml
vendored
@@ -1,5 +1,12 @@
|
|||||||
name: Ruff
|
name: Ruff
|
||||||
on: [ push ]
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
- dev-refactor # 例如:匹配所有以 feature/ 开头的分支
|
||||||
|
# 添加你希望触发此 workflow 的其他分支
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -7,6 +14,10 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
ruff:
|
ruff:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# 关键修改:添加条件判断
|
||||||
|
# 确保只有在 event_name 是 'push' 且不是由 Pull Request 引起的 push 时才运行
|
||||||
|
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/pull/')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -25,5 +36,4 @@ jobs:
|
|||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
git add -A
|
git add -A
|
||||||
git diff --quiet && git diff --staged --quiet || git commit -m "🤖 自动格式化代码 [skip ci]"
|
git diff --quiet && git diff --staged --quiet || git commit -m "🤖 自动格式化代码 [skip ci]"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
Reference in New Issue
Block a user