ci: Skip test suite when no code files changed#5889
ci: Skip test suite when no code files changed#5889stephanie-anderson wants to merge 3 commits intomasterfrom
Conversation
Add a `changes` detection job using dorny/paths-filter to all test
workflows and ci.yml. Tests are only triggered when code-relevant
files are modified (*.py, *.cfg, *.toml, *.ini, sentry_sdk/**, tests/**,
scripts/**, Makefile, .github/workflows/**).
PRs that only touch non-code files (e.g. README.md) will skip the
full test matrix, saving CI resources. Pushes to master/release
branches always run the full suite.
The gate jobs ("All X tests passed") now accept `skipped` as a valid
result so required status checks still pass when tests are skipped.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Langchain
Bug Fixes 🐛Ci
Openai
Other
Internal Changes 🔧Langchain
Openai
Other
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 7.88s All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 14412 uncovered lines. Generated by Codecov Action |
- Add requirements*.txt to path filters so dependency changes trigger CI - Gate job now also fails if the changes detection job itself fails, preventing untested code from passing CI when change detection errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Direct pushes to master are not allowed, so there's no need to force-run the full suite on push events. The paths-filter action now runs unconditionally for both push and pull_request events. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| - '.github/workflows/**' | ||
| test-ai: | ||
| needs: changes | ||
| if: needs.changes.outputs.has_code_changes == 'true' |
There was a problem hiding this comment.
Tests on master/release/major branches can be incorrectly skipped
The PR description states 'Pushes to master/release//major/ branches always run the full suite', but the test job's if condition (line 51) only checks needs.changes.outputs.has_code_changes == 'true' without considering the branch. This means pushes to protected branches that contain only non-code changes (e.g., a merge commit touching only docs) will skip tests, violating the stated requirement. The condition should include a bypass for push events to these protected branches.
Verification
Read the full workflow file (test-integrations-ai.yml) and both templates (base.jinja and test_group.jinja). Confirmed the if condition on line 51 is needs.changes.outputs.has_code_changes == 'true' with no branch-based exception. Cross-referenced with PR description which explicitly requires push events to master/release//major/ to always run tests. The dorny/paths-filter action does not automatically exempt certain branches from filtering.
Also found at 14 additional locations
.github/workflows/ci.yml:44-44.github/workflows/test-integrations-agents.yml:51-51.github/workflows/test-integrations-cloud.yml:51-51.github/workflows/test-integrations-common.yml:51-51.github/workflows/test-integrations-dbs.yml:51-51.github/workflows/test-integrations-gevent.yml:51-51.github/workflows/test-integrations-graphql.yml:51-51.github/workflows/test-integrations-mcp.yml:51-51.github/workflows/test-integrations-network.yml:51-51.github/workflows/test-integrations-tasks.yml:51-51.github/workflows/test-integrations-web-1.yml:51-51.github/workflows/test-integrations-web-2.yml:51-51.github/workflows/test-integrations-flags.yml:51-51scripts/split_tox_gh_actions/templates/base.jinja:36-56
Identified by Warden code-review · G7J-P8F
Summary
changesdetection job (usingdorny/paths-filter) to all 16 test workflows andci.yml*.py,*.cfg,*.toml,*.ini,sentry_sdk/**,tests/**,scripts/**,Makefile,requirements*.txt,.github/workflows/**README.md,LICENSE,CHANGELOG.md) skip the full test matrixskippedas a valid result so required status checks still passChanges
base.jinja,test_group.jinja,check_required.jinja): Addedchangesjob, conditional test execution, and skipped-aware gate checksci.yml: Same pattern applied to lint, build, and docs jobsTest plan
README.md→ verify tests are skipped and gate jobs pass.pyfile → verify tests run normallyCo-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com