mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
e8866c8b7a
CI jobs in `build_and_test` printed a "Cache save failed." warning from the "Save passed-tests cache" step even when they never run tests. The step ran for every job with an `afterBuild` command, but `.next-test-passed.txt` is only ever written by `run-tests.js`, so jobs like lint, rust-check, or types-and-precompiled warned on every run because the path never existed. `run-tests.js` already owns the decision of whether result caching is active (`profile.cachingEnabled`), so it now signals the workflow itself: when it opens the passed-tests file (which happens before any test runs, and only when result caching is enabled), it writes the path to the `passed_tests_file` step output. The "Save passed-tests cache" step in `build_reusable.yml` only runs when that output is present and takes its `path` from it. Jobs that never run `run-tests.js`, and flake-detection runs (where `NEXT_FLAKE_DETECTION` disables the result cache), never emit the output and skip the save silently. A job that fails midway through its tests has already emitted the output, so its partial file still saves and a genuine warning is still possible.