Commit b2208a0
committed
Optimize GitHub Actions: Prevent duplicate workflow runs on PRs
Currently, workflows trigger twice for pull requests:
1. Once via 'push' event when pushing to PR branch
2. Once via 'pull_request' event
This wastes CI resources by running the same tests twice.
Solution:
- Restrict 'push' trigger to only run on 'main' branch
- Keep 'pull_request' trigger for all PRs
- Maintain 'workflow_call' and 'workflow_dispatch' for manual/reusable workflows
Result:
- Pushes to main: runs once via push event
- Pull requests: runs once via pull_request event
- 50% reduction in CI runs for PRs1 parent 7605599 commit b2208a0
2 files changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments