Skip to content

Exclude documentation and .github from CI triggers - #13214

Merged
rainersigwald merged 4 commits into
mainfrom
copilot/update-ci-trigger-paths
Apr 28, 2026
Merged

Exclude documentation and .github from CI triggers#13214
rainersigwald merged 4 commits into
mainfrom
copilot/update-ci-trigger-paths

Conversation

Copilot AI commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Context

CI pipelines trigger full test runs for changes to documentation and Copilot instruction files (.github/), wasting resources on non-build file changes.

Changes Made

.vsts-dotnet-ci.yml

  • Added paths.exclude filters to the trigger section for documentation/* and .github/*
  • Converts simple branch list to structured format required for path filtering
  • Does not exclude paths for PR builds to ensure required checks always run and PRs can go green
trigger:
  branches:
    include:
    - main
    - exp/*
    - vs*
  paths:
    exclude:
    - documentation/*
    - .github/*

azure-pipelines/check-documentation-only-change.yml

  • Expanded PowerShell pattern matching to recognize .github/* files as non-build files:
$isNonBuildFile = ($file -match "^documentation/") -or ($file -match "^\.github/")
  • Preserves onlyDocChanged variable name for backward compatibility with 84+ downstream references
  • Updated comments and display name to reflect expanded scope

Testing

Validated PowerShell logic handles all scenarios: documentation-only, .github-only, mixed non-build files, and code file inclusions.

Notes

Pipeline will no longer trigger for direct commits to main/exp/vs branches when only documentation or .github files change. PR builds will always run to satisfy required checks, but the check-documentation-only-change.yml template will skip expensive tests when only non-build files are detected.

Original prompt

Problem

Azure DevOps test jobs trigger and run for a long time even when only non-build files like Copilot instructions (.github/) or documentation (documentation/) are changed. This wastes CI resources.

Solution

Make two changes:

1. Add paths.exclude to the CI and PR triggers in .vsts-dotnet-ci.yml

The file currently has a simple trigger with no path filters:

trigger:
- main
- exp/*
- vs*

Change this to use paths.exclude so the pipeline doesn't even start for non-build file changes:

trigger:
  branches:
    include:
    - main
    - exp/*
    - vs*
  paths:
    exclude:
    - documentation/*
    - .github/*

pr:
  paths:
    exclude:
    - documentation/*
    - .github/*

This is a GitHub-hosted repo, so both trigger: and pr: support YAML paths filters.

2. Expand azure-pipelines/check-documentation-only-change.yml to also recognize .github/ files

The current check only recognizes files under documentation/:

$isUnderDocumentation = $file -match "^documentation/"

Update this to also treat .github/ files as non-build changes, so that even in mixed-commit scenarios, the safety net correctly identifies non-build-only changes. Change the variable name and match to something like:

$isNonBuildFile = ($file -match "^documentation/") -or ($file -match "^\.github/")
if(!$isNonBuildFile)

Make sure the output variable name (onlyDocChanged) stays the same so all downstream references continue to work.

Context

  • PR Expand test instructions into their own file #13212 adds Copilot test instruction files under .github/ — this is the kind of change that should not trigger full test runs.
  • The repo's CI pipeline is at .vsts-dotnet-ci.yml.
  • The documentation-only check template is at azure-pipelines/check-documentation-only-change.yml.
  • Many jobs reference the onlyDocChanged variable — do NOT rename it.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hello @@copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo.

Copilot AI changed the title [WIP] Update CI triggers to exclude non-build file changes Exclude documentation and .github from CI triggers Feb 6, 2026
Copilot AI requested a review from rainersigwald February 6, 2026 17:39
Comment thread .vsts-dotnet-ci.yml Outdated
@rainersigwald
rainersigwald marked this pull request as ready for review April 6, 2026 19:49
@rainersigwald
rainersigwald requested a review from a team as a code owner April 6, 2026 19:49
Copilot AI review requested due to automatic review settings April 6, 2026 19:49
@rainersigwald rainersigwald added the Area: Our Own Build Problems affecting the build or build infrastructure of the MSBuild repo itself. label Apr 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces unnecessary CI runs by preventing the main CI pipeline from triggering on documentation-only or .github/-only pushes, and by expanding the “documentation-only change” gate to also treat .github/ changes as non-build changes.

Changes:

  • Added trigger.paths.exclude filters in .vsts-dotnet-ci.yml for documentation/ and .github/.
  • Updated azure-pipelines/check-documentation-only-change.yml PowerShell logic to treat .github/ changes as non-build, while preserving the onlyDocChanged variable contract.
  • Updated template comment and display name to reflect the broadened scope.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.vsts-dotnet-ci.yml Adds path-based exclusions to avoid starting CI for doc / .github-only pushes.
azure-pipelines/check-documentation-only-change.yml Extends the non-build-only detection logic to include .github/ paths.

Comment thread .vsts-dotnet-ci.yml Outdated
@JanProvaznik
JanProvaznik enabled auto-merge (squash) April 21, 2026 11:20
Copilot AI and others added 4 commits April 28, 2026 06:12
…-build file detection

Co-authored-by: rainersigwald <3347530+rainersigwald@users.noreply.github.com>
Co-authored-by: rainersigwald <3347530+rainersigwald@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@baronfel
baronfel force-pushed the copilot/update-ci-trigger-paths branch from 93ba551 to 0f7cc70 Compare April 28, 2026 11:12
@rainersigwald
rainersigwald disabled auto-merge April 28, 2026 11:12
@rainersigwald
rainersigwald merged commit fc7b40d into main Apr 28, 2026
1 of 9 checks passed
@rainersigwald
rainersigwald deleted the copilot/update-ci-trigger-paths branch April 28, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Our Own Build Problems affecting the build or build infrastructure of the MSBuild repo itself.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants