Skip to content

Commit 9cde91b

Browse files
committed
ci(workflows): simplify GitHub Actions trigger conditions
- remove redundant push and pull_request triggers from workflows - add descriptive run-name to improve workflow identification - streamline conditional execution logic for workflows - update comments to reflect new trigger conditions
1 parent 19f8b18 commit 9cde91b

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

.github/workflows/benchmark.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Performance Benchmark
22

3+
run-name: "⚡ Benchmark · ${{ github.event_name == 'workflow_dispatch' && 'Manual Run' || github.event.workflow_run.head_branch }}"
4+
35
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
86
workflow_run:
97
workflows: ["Unit Tests"]
108
types:
@@ -17,8 +15,6 @@ jobs:
1715
# 依赖 unit test 成功,或手动触发
1816
if: |
1917
github.event_name == 'workflow_dispatch' ||
20-
github.event_name == 'push' ||
21-
github.event_name == 'pull_request' ||
2218
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
2319
runs-on: ubuntu-latest
2420
steps:

.github/workflows/deploy_docs.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Documentation
22

3+
run-name: "📚 Documentation · ${{ github.event_name == 'workflow_dispatch' && 'Manual Deploy' || github.event.workflow_run.head_branch }}"
4+
35
on:
4-
push:
5-
branches: [main]
66
workflow_run:
77
workflows: ["Unit Tests"]
88
types:
@@ -36,10 +36,9 @@ jobs:
3636
# Build job
3737
generate_docs:
3838
runs-on: ubuntu-latest
39-
# 只在 push 到 main 或 unit test 成功后执行
39+
# 只在 unit test 成功后或手动触发时执行
4040
if: |
4141
github.event_name == 'workflow_dispatch' ||
42-
github.event_name == 'push' ||
4342
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
4443
steps:
4544
- name: Checkout

.github/workflows/format-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Code Format Check
22

3+
run-name: "🎨 Format Check · ${{ github.event_name == 'pull_request' && format('PR #{0}', github.event.pull_request.number) || github.ref_name }}"
4+
35
on:
46
push:
57
branches:

.github/workflows/test.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Unit Tests
22

3+
run-name: "🧪 Unit Tests · ${{ github.event_name == 'schedule' && 'Scheduled (master)' || (github.event_name == 'workflow_dispatch' && 'Manual Run' || github.event.workflow_run.head_branch) }}"
4+
35
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
86
schedule:
97
# 每天凌晨 2 点执行
108
- cron: "0 2 * * *"
@@ -17,13 +15,11 @@ on:
1715
jobs:
1816
test:
1917
name: Unit Test
20-
# 依赖 format check,但定时任务或手动触发时跳过
18+
# 依赖 format check 成功,或定时任务/手动触发时执行
2119
if: |
2220
github.event_name == 'schedule' ||
2321
github.event_name == 'workflow_dispatch' ||
24-
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
25-
github.event_name == 'push' ||
26-
github.event_name == 'pull_request'
22+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
2723
strategy:
2824
matrix:
2925
os: [ubuntu-latest]

0 commit comments

Comments
 (0)