From 916810a497df1a75e59514daa7b5473c2f62c4cc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 9 Sep 2026 16:16:12 +0000 Subject: [PATCH 1/2] 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 https://github.com/github/docs/issues/42379 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01FuL8Cm3afpXSBiiGnUo7FA --- .../customize-cloud-agent/customize-the-agent-environment.md | 4 ++++ content/copilot/tutorials/cloud-agent/improve-a-project.md | 2 ++ 2 files changed, 6 insertions(+) diff --git a/content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md b/content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md index 8ee0ce1cf4e6..3fc4691cce08 100644 --- a/content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md +++ b/content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md @@ -58,7 +58,11 @@ name: "Copilot Setup Steps" # allow manual testing through the repository's "Actions" tab on: workflow_dispatch: + # Limit `push` to your default branch. Changes on any other branch are already validated + # by the `pull_request` trigger, so this avoids two runs for the same commit. push: + branches: + - main paths: - .github/workflows/copilot-setup-steps.yml pull_request: diff --git a/content/copilot/tutorials/cloud-agent/improve-a-project.md b/content/copilot/tutorials/cloud-agent/improve-a-project.md index 9f5a6692e5d1..e30d636886bb 100644 --- a/content/copilot/tutorials/cloud-agent/improve-a-project.md +++ b/content/copilot/tutorials/cloud-agent/improve-a-project.md @@ -98,6 +98,8 @@ Creating this file is optional but is a good idea if you use {% data variables.c on: workflow_dispatch: push: + branches: + - main paths: - .github/workflows/copilot-setup-steps.yml pull_request: From dbab31854ec0225a1b45b74324efd0353c2734b8 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 10 Sep 2026 01:59:39 +0000 Subject: [PATCH 2/2] Generalize copilot-setup-steps sample intro instead of changing triggers Revert the workflow trigger change and address the redundancy in the copy, per maintainer feedback on issue 42379: the sample is an illustrative snippet rather than something readers are expected to copy verbatim. Generalize the sentence introducing the sample so it covers workflow triggers alongside language and dependencies, and note that you wouldn't typically run on both `push` and `pull_request`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01FuL8Cm3afpXSBiiGnUo7FA --- .../customize-the-agent-environment.md | 6 +----- content/copilot/tutorials/cloud-agent/improve-a-project.md | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md b/content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md index 3fc4691cce08..d21e2c4a470a 100644 --- a/content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md +++ b/content/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/customize-the-agent-environment.md @@ -49,7 +49,7 @@ A `copilot-setup-steps.yml` file looks like a normal {% data variables.product.p > [!NOTE] > The `copilot-setup-steps.yml` workflow won't trigger unless it's present on your default branch. -Here is a simple example of a `copilot-setup-steps.yml` file for a TypeScript project that clones the project, installs Node.js and downloads and caches the project's dependencies. You should customize this to fit your own project's language(s) and dependencies: +Here is a simple example of a `copilot-setup-steps.yml` file for a TypeScript project that clones the project, installs Node.js and downloads and caches the project's dependencies. You should customize this to fit your own project, including its language(s), its dependencies, and the workflow triggers you need. For example, you wouldn't typically run on both `push` and `pull_request`. ```yaml copy name: "Copilot Setup Steps" @@ -58,11 +58,7 @@ name: "Copilot Setup Steps" # allow manual testing through the repository's "Actions" tab on: workflow_dispatch: - # Limit `push` to your default branch. Changes on any other branch are already validated - # by the `pull_request` trigger, so this avoids two runs for the same commit. push: - branches: - - main paths: - .github/workflows/copilot-setup-steps.yml pull_request: diff --git a/content/copilot/tutorials/cloud-agent/improve-a-project.md b/content/copilot/tutorials/cloud-agent/improve-a-project.md index e30d636886bb..9f5a6692e5d1 100644 --- a/content/copilot/tutorials/cloud-agent/improve-a-project.md +++ b/content/copilot/tutorials/cloud-agent/improve-a-project.md @@ -98,8 +98,6 @@ Creating this file is optional but is a good idea if you use {% data variables.c on: workflow_dispatch: push: - branches: - - main paths: - .github/workflows/copilot-setup-steps.yml pull_request: