Skip to content

Exclude .github/CODEOWNERS (and .github/**) from CI triggers across all AzDO pipelines#13642

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/update-azure-pipeline-yaml
Draft

Exclude .github/CODEOWNERS (and .github/**) from CI triggers across all AzDO pipelines#13642
Copilot wants to merge 2 commits into
mainfrom
copilot/update-azure-pipeline-yaml

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

Context

PR #13214 added documentation/** and .github/** path exclusions to .vsts-dotnet-ci.yml, but two other push-triggered pipelines still had simple trigger lists with no path filtering, causing full CI runs on CODEOWNERS-only changes.

Changes Made

  • .vsts-dotnet.yml — Converted simple trigger list to structured format; added paths.exclude for documentation/** and .github/**
  • azure-pipelines/.vsts-dotnet-exp-perf.yml — Same treatment for exp/* / perf/* triggers
  • azure-pipelines/check-documentation-only-change.yml — Added comment clarifying that .github/CODEOWNERS is already matched by the existing ^\.github/ pattern (no logic change)

Push triggers now skip CI for .github/CODEOWNERS (and all .github/** / documentation/**) changes across all three active push-triggered pipelines. PR triggers are intentionally left unchanged so required checks continue to satisfy branch protection; the check-documentation-only-change.yml template already gates expensive test jobs via onlyDocChanged.

Testing

No executable code changed — YAML-only.

Notes

Pipelines with trigger: none (vs-insertion.yml, vmr-sb-validation.yml) are unaffected.

Original prompt

Update Azure DevOps pipeline YAML configuration in dotnet/msbuild so that changes to CODEOWNERS do not trigger CI pipelines.

Context:

  • Prior merged PR Exclude documentation and .github from CI triggers #13214 added trigger.paths.exclude for documentation/** and .github/** in .vsts-dotnet-ci.yml (push CI only) and expanded azure-pipelines/check-documentation-only-change.yml to treat .github/ changes as non-build files while keeping onlyDocChanged variable.
  • We now specifically want CODEOWNERS changes to not trigger AzDO pipelines, and we want this applied across all pipelines in the repo (not just .vsts-dotnet-ci.yml).
  • Also check PR Exclude documentation and .github from CI triggers #13214 for repo-specific checks that may need updating (e.g., templates/gates that decide to skip expensive jobs when non-build-only changes are detected).

Requirements:

  1. Find all Azure DevOps pipeline YAML definitions in the repo (commonly: .vsts-*.yml, azure-pipelines*.yml, files under azure-pipelines/, and any other YAMLs that contain top-level trigger: and/or pr: blocks).
  2. For each pipeline that triggers on GitHub changes, ensure changes limited to .github/CODEOWNERS do not start CI runs.
    • Prefer trigger.paths.exclude for .github/CODEOWNERS.
    • If a pipeline already excludes .github/**, ensure .github/CODEOWNERS is covered; otherwise add a specific exclusion.
    • Consider both trigger: (push) and pr: filters. Align with repo policy from PR Exclude documentation and .github from CI triggers #13214: push triggers may exclude non-build-only changes, while PR builds may still need to run to satisfy required checks. If CODEOWNERS-only PRs still must pass required checks, implement repo’s existing “non-build-only change” gate to early-exit expensive jobs instead of excluding PR triggers entirely.
  3. Update/extend any repo-specific “only documentation/non-build change” detection templates (like azure-pipelines/check-documentation-only-change.yml) so that CODEOWNERS-only changes are considered non-build-only, and downstream jobs can skip expensive test runs.
    • Ensure the existing variable contract (onlyDocChanged) remains unchanged.
    • Make matching robust for .github/CODEOWNERS.
  4. Keep changes minimal and consistent across pipelines; don’t break DevDiv-specific behavior.
  5. Add/adjust comments in pipeline YAML where needed to explain the intent.

Deliverable:

  • Open a PR against main with all required YAML/template updates.
  • Ensure the PR description summarizes which pipelines were updated and how CODEOWNERS-only changes are handled for push vs PR triggers.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: CodeOwners changes in the MSBuild repo shouldn't trigger CI pipelines in azdo

Assistant: To prevent CODEOWNERS-only changes from triggering Azure DevOps (AzDO) pipelines for dotnet/msbuild, you need to add a path-based exclusion for .github/CODEOWNERS in your AzDO pipeline triggers.

If the pipeline is defined in YAML

In the relevant azure-pipelines.yml (or any YAML that defines CI triggers), add a paths.exclude entry:

trigger:
  branches:
    include:
    - "*"
  paths:
    exclude:
    - .github/CODEOWNERS

If you also have PR validation triggers, exclude it there too:

pr:
  branches:
    include:
    - "*"
  paths:
    exclude:
    - .github/CODEOWNERS

If the pipeline is “classic” (UI-defined) instead of YAML

In Pipeline → Edit → Triggers, add a Path filter exclusion for:

  • /.github/CODEOWNERS

Notes / gotchas

  • If your repo has multiple pipelines, you must apply the exclusion to each one that shouldn’t run.
  • If you want to exclude all CODEOWNERS files (some repos have multiple), you can broaden to:
    • .github/CODEOWNERS
    • CODEOWNERS (root) if applicable

If you point me at the specific AzDO pipeline YAML path(s) used by msbuild (or paste the current trigger: / pr: sections), I can rewrite the exact snippet to match what’s already there (e.g., existing branch filters, batching, etc.).

User: investigate and apply this to all pipelines in the dotnet/msbuidl repo

Assistant: I can’t apply changes yet because (1) you didn’t explicitly ask for a PR, and (2) I need the exact repo name confirmed: you wrote dotnet/msbuidl (typo) but earlier provided dotnet/msbuild.

If you want me to investigate all Azure Pipelines YAMLs in dotnet/msbuild and then apply the .github/CODEOWNERS path exclusion everywhere, tell me one of the following:

  1. “Yes—open a PR in dotnet/msbuild” (and which base branch, if not default), or
  2. “Just report findings, no code changes.”

Once confirmed, I will:

  • locate every azure-pipelines*.yml (and any YAML templates that define trigger: / pr:),
  • list which pipelines currently trigger on CODEOWNERS-only changes,
  • update each pipeline to exclude .github/CODEOWNERS from both trigger and pr (where present),
    -...

This pull request was created from Copilot chat.

@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.

…net.yml and .vsts-dotnet-exp-perf.yml

Agent-Logs-Url: https://github.com/dotnet/msbuild/sessions/6e72ed82-a8aa-4a66-bfff-43ef633d3744

Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Azure DevOps pipeline YAML to exclude CODEOWNERS changes from CI Exclude .github/CODEOWNERS (and .github/**) from CI triggers across all AzDO pipelines Apr 28, 2026
Copilot AI requested a review from baronfel April 28, 2026 11:22
Comment thread .vsts-dotnet.yml
Comment on lines +6 to +9
paths:
exclude:
- documentation/**
- .github/**
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we can do this, because we have a required check that the PR builds pass. Won't this result in PRs stuck on that check without ever triggering a build? @copilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants