A matrix workflow runs twelve jobs and only two of them failed because of a flaky network call. The engineer has confirmed the code is correct and wants to retry just the two failed jobs while reusing the results of the ten that already passed, keeping runner minutes to a minimum. Which action on the completed run achieves this?
- AChoose Re-run failed jobs, because it re-executes only the jobs that failed in this run and keeps the results of the jobs that already succeeded. Correct
- BChoose Re-run all jobs, because it restarts the whole run and only the previously failed jobs are actually re-executed while passing jobs are skipped.
- CPush an empty commit to the branch, because that triggers a fresh run that GitHub limits to the jobs that did not succeed in the previous run.
- DCancel the run and start it again from the Actions tab, because cancelling preserves the passing jobs so only the failed ones run when the workflow restarts.
Why A is correct: Re-run failed jobs re-executes only the jobs that did not succeed in the same run while preserving the passing jobs' results, so the two flaky jobs are retried with the least runner usage.
Why B is wrong: Tempting because it reuses the same run, but Re-run all jobs re-executes every job in the run, including the ten that passed, so it consumes far more runner minutes than required.
Why C is wrong: Tempting because a new commit re-triggers the workflow, but it starts an entirely new run that executes all matrix jobs from scratch and does not reuse any earlier passing results.
Why D is wrong: Tempting because it sounds targeted, but the run has already completed so there is nothing to cancel, and restarting the workflow would run the full matrix rather than only the failures.