Skip to content

ci: skip unit and E2E tests when no relevant files changed#59

Merged
nitrocode merged 1 commit into
mainfrom
copilot/add-test-requirements-for-css-js-ts
Apr 24, 2026
Merged

ci: skip unit and E2E tests when no relevant files changed#59
nitrocode merged 1 commit into
mainfrom
copilot/add-test-requirements-for-css-js-ts

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

Tests run unconditionally on every PR, burning CI minutes on docs, YAML, and config-only changes.

Changes

  • changes job — added to both workflows using dorny/paths-filter@v3.0.2 (SHA-pinned); detects changes to **/*.js, **/*.ts, **/*.css, tests/**, package*.json
  • Test jobs — gated with if: needs.changes.outputs.code == 'true'; skipped entirely when no relevant files changed
  • Gate jobs (unit-test-status, e2e-test-status) — run if: always(), exit 1 on failure, exit 0 on skip; these replace the raw test jobs as the required status checks
jobs:
  changes:
    outputs:
      code: ${{ steps.filter.outputs.code }}
    steps:
      - uses: dorny/paths-filter@de90cc6... # v3.0.2
        id: filter
        with:
          filters: |
            code:
              - '**/*.js'
              - '**/*.ts'
              - '**/*.css'
              - 'tests/**'
              - 'package*.json'

  test:
    needs: changes
    if: needs.changes.outputs.code == 'true'
    # ... existing steps unchanged ...

  unit-test-status:       # ← register this as the required status check
    needs: [changes, test]
    if: always()
    steps:
      - run: |
          if [[ "${{ needs.test.result }}" == "failure" ]]; then exit 1; fi

Action required: update branch protection rules to require unit-test-status and e2e-test-status instead of test and test-e2e.

Summary by CodeRabbit

  • Chores
    • Enhanced CI/CD efficiency by implementing smart change detection that runs test suites only when relevant code or configuration files are modified, reducing unnecessary pipeline execution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Yo, listen up fool! Both workflow files now implement conditional test execution using path-based change detection via dorny/paths-filter. The changes job detects modifications to code, tests, and package files, and gates the test jobs accordingly. A new status job runs with always() to explicitly report test results, sucker! I pity the fool who runs unnecessary tests!

Changes

Cohort / File(s) Summary
CI Workflow Conditional Execution
.github/workflows/e2e-tests.yml, .github/workflows/unit-tests.yml
Both workflows now include a changes job detecting file modifications and a status job that gates test execution on code changes, preventing unnecessary test runs, fool!

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


Fool, Mr. T done told you straight! These here changes is just CI configuration updates, sucka—ain't no complex logic or jibber jabber to worry about! The pattern's the same across both files, so it ain't gonna take no fool long to review! I pity the fool who makes this harder than it gotta be! 💪

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: skip unit and E2E tests when no relevant files changed' directly and accurately summarizes the main change—adding path-based change detection to conditionally skip tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch copilot/add-test-requirements-for-css-js-ts

Comment @coderabbitai help to get the list of available commands and usage tips.

@nitrocode nitrocode marked this pull request as ready for review April 24, 2026 04:08
@nitrocode nitrocode self-requested a review as a code owner April 24, 2026 04:08
@github-actions
Copy link
Copy Markdown
Contributor

👁️ PR Preview

🚀 Open Preview

Deployed from commit 48d0699 · Updates on every push to this PR
(Preview is removed automatically when the PR is closed.)

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.

2 participants