Add change detection to unit-tests.yaml to skip tests on doc-only changes#11283
Add change detection to unit-tests.yaml to skip tests on doc-only changes#11283
Conversation
Co-authored-by: brooke-hamilton <45323234+brooke-hamilton@users.noreply.github.com>
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
There was a problem hiding this comment.
Pull request overview
This PR adds change detection logic to the unit-tests.yaml workflow to skip unit test execution when only documentation or markdown files are modified in pull requests. The change aligns the unit test workflow with the existing pattern already used by functional test workflows, improving CI efficiency by avoiding unnecessary test runs while ensuring tests always execute on pushes to protected branches.
Changes:
- Added
changesjob that calls the reusable__changes.ymlworkflow to detect if only docs/markdown files changed - Modified
unit-testsjob to depend onchangesand conditionally skip whenonly_changed == 'true' - Added appropriate
contents: readandpull-requests: readpermissions to thechangesjob
Unit Tests4 783 tests 4 780 ✅ 7m 46s ⏱️ Results for commit c230a2a. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11283 +/- ##
==========================================
+ Coverage 50.98% 50.99% +0.01%
==========================================
Files 679 679
Lines 43174 43174
==========================================
+ Hits 22012 22017 +5
+ Misses 19040 19036 -4
+ Partials 2122 2121 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
unit-tests.yamllacked the change detection logic already present in the functional test workflows, causing unit tests to run unnecessarily on PRs that only touch docs, markdown, or other unrelated files.Changes
changesjob calling the reusable.github/workflows/__changes.ymlworkflow — same pattern used byfunctional-test-noncloud.yamlandfunctional-test-cloud.yamlunit-testsjob onneeds.changes.outputs.only_changed != 'true'; the reusable workflow ensures tests still run unconditionally on non-PR events (pushes tomain/release/*)Type of change
Contributor checklist
Original prompt
💡 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 in the docs.