ci: skip tests on Markdown-only PRs without leaving required checks pending

Closed
FA
21d ago
+107-8

Problem

unit_tests.yml, integration_tests.yml, integration_app_harness.yml and reflex_init_in_docker_test.yml use a pull_request paths-ignore: "**/*.md". A workflow that path filters skip reports no status. Branch protection requires 40 of their jobs by name, so a Markdown-only PR (for example #7327) shows them as "Expected — Waiting for status to be reported" forever and cannot merge.

Fix

  • New reusable workflow detect_changes.yml. On pull_request it diffs the merge commit against its base (HEAD^1..HEAD) and outputs code=false only when every changed file is *.md. On other events it outputs code=true.
  • The four workflows always start on pull_request. Their test jobs use needs: changes and if: needs.changes.outputs.code == 'true'. The push trigger keeps its paths-ignore.
  • One gate job per workflow: unit-tests-result, integration-tests-result, integration-app-harness-result, reflex-init-in-docker-test-result. It runs with if: always() and fails only when a needed job failed or was cancelled. A skipped test job counts as a pass.
  • Python 3.15 legs get continue-on-error. Branch protection does not require them today, and the gates keep it that way.

On a Markdown-only PR, the tests do not run. Only the ~10 s detect job and the ~5 s gate jobs run.

Required admin follow-up (branch protection)

A matrix job that its if skips does not report its per-leg check names, so the current 40 per-leg required checks would still wait. After this merges, in branch protection for main:

  1. Remove the required checks unit-tests (…), integration-app-harness (…), integration-app-harness-playwright (…), example-counter-and-nba-proxy (…), reflex-docs (…), rx-shout-from-template and reflex-install-and-init.
  2. Add the required checks unit-tests-result, integration-tests-result, integration-app-harness-result and reflex-init-in-docker-test-result.

Verification

  • actionlint passes on all five workflow files.
  • I ran the detect logic locally against real PR merge refs: #7327 (docs only) → code=false; #7341, #7344 and #7345 (code + .md news fragments) → code=true; an empty diff → code=true.
  • This PR changes .yml files, so its own run covers the code=true path. The first Markdown-only PR after the merge will cover the skip path.