Commit 85ab1b9
feat(ci): skip workflows on bot branches to avoid redundant CI runs (#4916)
This PR implements a feature request to skip all GitHub workflows on
push events for bot-created branches to avoid redundant CI runs and save
resources.
## Problem
Bot-created branches (`copilot/*`, `dependabot/*`, and
`pre-commit-ci-update-config`) currently trigger workflows on both push
events and when PRs are created. This creates duplicate CI runs since
the same tests will run again when the PR is opened, wasting CI time and
resources.
## Solution
Added `branches-ignore` patterns to workflow files that have push
triggers to skip the following branch patterns:
- `copilot/**` - GitHub Copilot branches
- `dependabot/**` - Dependabot dependency update branches
- `pre-commit-ci-update-config` - Pre-commit CI configuration update
branches
## Changes Made
Updated 8 workflow files with bot branch ignore patterns:
- `build_cc.yml`, `build_wheel.yml`, `codeql.yml`, `package_c.yml`,
`test_cc.yml`, `test_python.yml` - Added bot branch patterns to existing
`branches-ignore` lists
- `copilot-setup-steps.yml` - Added `branches-ignore` alongside existing
`paths` filter
- `mirror_gitee.yml` - Converted from array syntax to explicit push
configuration with `branches-ignore`
The `todo.yml` workflow was left unchanged since it only runs on the
`devel` branch, making bot branch exclusions unnecessary.
Example of the change:
```yaml
on:
push:
branches-ignore:
- "gh-readonly-queue/**" # existing
- "copilot/**" # new
- "dependabot/**" # new
- "pre-commit-ci-update-config" # new
```
## Impact
- ✅ Bot branches will skip workflows on push events but still trigger
them when PRs are created
- ✅ Normal development branches continue to trigger workflows as
expected
- ✅ Reduces unnecessary CI runs and resource usage
- ✅ Maintains full test coverage through PR-triggered workflows
- ✅ All workflow files maintain valid YAML syntax
Fixes #4915.
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: njzjz <[email protected]>1 parent 58ce1aa commit 85ab1b9
File tree
8 files changed
+30
-1
lines changed- .github/workflows
8 files changed
+30
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
4 | 11 | | |
5 | 12 | | |
6 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
0 commit comments