Skip to content

Commit 85ab1b9

Browse files
Copilotnjzjz
andauthored
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

8 files changed

+30
-1
lines changed

.github/workflows/build_cc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ on:
22
push:
33
branches-ignore:
44
- "gh-readonly-queue/**"
5+
- "copilot/**"
6+
- "dependabot/**"
7+
- "pre-commit-ci-update-config"
58
pull_request:
69
merge_group:
710
concurrency:

.github/workflows/build_wheel.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
branches-ignore:
66
- "gh-readonly-queue/**"
7+
- "copilot/**"
8+
- "dependabot/**"
9+
- "pre-commit-ci-update-config"
710
tags:
811
- "v*"
912
pull_request:

.github/workflows/codeql.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
branches-ignore:
66
- "gh-readonly-queue/**"
7+
- "copilot/**"
8+
- "dependabot/**"
9+
- "pre-commit-ci-update-config"
710
pull_request:
811
schedule:
912
- cron: '45 2 * * 2'

.github/workflows/copilot-setup-steps.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ name: "Copilot Setup Steps"
55
on:
66
workflow_dispatch:
77
push:
8+
branches-ignore:
9+
- "copilot/**"
10+
- "dependabot/**"
11+
- "pre-commit-ci-update-config"
812
paths:
913
- .github/workflows/copilot-setup-steps.yml
1014
pull_request:

.github/workflows/mirror_gitee.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
name: Mirror to Gitee Repo
22

3-
on: [ push, delete, create ]
3+
on:
4+
push:
5+
branches-ignore:
6+
- "copilot/**"
7+
- "dependabot/**"
8+
- "pre-commit-ci-update-config"
9+
delete:
10+
create:
411

512
# Ensures that only one mirror task will run at a time.
613
concurrency:

.github/workflows/package_c.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
push:
55
branches-ignore:
66
- "gh-readonly-queue/**"
7+
- "copilot/**"
8+
- "dependabot/**"
9+
- "pre-commit-ci-update-config"
710
tags:
811
- "v*"
912
pull_request:

.github/workflows/test_cc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ on:
22
push:
33
branches-ignore:
44
- "gh-readonly-queue/**"
5+
- "copilot/**"
6+
- "dependabot/**"
7+
- "pre-commit-ci-update-config"
58
pull_request:
69
merge_group:
710
concurrency:

.github/workflows/test_python.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ on:
22
push:
33
branches-ignore:
44
- "gh-readonly-queue/**"
5+
- "copilot/**"
6+
- "dependabot/**"
7+
- "pre-commit-ci-update-config"
58
pull_request:
69
merge_group:
710
concurrency:

0 commit comments

Comments
 (0)