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 ±0 4 779 ✅ - 1 7m 37s ⏱️ -4s For more details on these failures, see this check. Results for commit 853d923. ± Comparison against base commit 088b1fe. ♻️ This comment has been updated with latest results. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11283 +/- ##
==========================================
- Coverage 51.00% 51.00% -0.01%
==========================================
Files 679 679
Lines 43174 43174
==========================================
- Hits 22023 22019 -4
- Misses 19033 19035 +2
- Partials 2118 2120 +2 ☔ 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.