Skip to content

Commit 916810a

Browse files
committed
Scope push to the default branch in copilot-setup-steps samples
The sample `copilot-setup-steps.yml` workflow triggered on both `push` and `pull_request` with the same `paths` filter. For a branch pushed to the same repository, both events fire on the same commit, so the workflow ran twice and produced two identical check runs on the pull request. Limit the `push` trigger to the default branch. Changes on any other branch are still validated through the `pull_request` trigger (including pull requests from forks, which `push` does not cover in the base repository), and the workflow still runs when the file lands on the default branch. Fixes #42379 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FuL8Cm3afpXSBiiGnUo7FA
1 parent 9753a30 commit 916810a

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ name: "Copilot Setup Steps"
5858
# allow manual testing through the repository's "Actions" tab
5959
on:
6060
workflow_dispatch:
61+
# Limit `push` to your default branch. Changes on any other branch are already validated
62+
# by the `pull_request` trigger, so this avoids two runs for the same commit.
6163
push:
64+
branches:
65+
- main
6266
paths:
6367
- .github/workflows/copilot-setup-steps.yml
6468
pull_request:

‎content/copilot/tutorials/cloud-agent/improve-a-project.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ Creating this file is optional but is a good idea if you use {% data variables.c
9898
on:
9999
workflow_dispatch:
100100
push:
101+
branches:
102+
- main
101103
paths:
102104
- .github/workflows/copilot-setup-steps.yml
103105
pull_request:

0 commit comments

Comments
 (0)