fj run rerun: --failed and --job to rerun part of a run (#168) #177
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/168-rerun-failed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
On a matrix where one job flaked,
fj run rerun Nreran the whole run, wasting minutes and runner cost re-doing the jobs that already passed. This adds two flags to rerun just the part that needs it.What
fj run rerun N --failedreruns only the jobs that did not finish green (anything butsuccess/skipped), reusing the same "non-green" definition asview --log-failed. If the run has no failed jobs it says so and does nothing.fj run rerun N --job Jreruns a single job.Jis the job index in the order shown byfj run view; it is validated against the run first, so a typo fails with a clear out-of-range message instead of a bare web-route 404.conflicts_with), and barefj run rerun Nstill reruns the whole run, unchanged.Forgejo has no rerun API, so both flags POST the human-facing per-job web route,
/actions/runs/{run}/jobs/{job}/rerun, one POST per targeted job. Worth noting: job index0is a real job there, not a "rerun all" sentinel. Forgejo keys "rerun all" off the absence of the{job}path segment, so--job 0correctly reruns just the first job rather than the run.Unit tests cover the flag parsing and mutual exclusivity, the failed-job selection, and the per-job vs run-level routing (including that index 0 hits the job route and that a token 404 surfaces the actionable message).
docs/gh-to-fj.mdand the changelog updated.cargo fmt --check,cargo clippy --all-targets, and the full test suite pass locally.Closes #168.
Bare `fj run rerun N` still reruns the whole run. `--failed` reruns only the jobs that did not finish green; `--job J` reruns a single job by the index shown in `fj run view`. The two flags are mutually exclusive. Forgejo has no rerun API, so both go through the per-job web route (`/actions/runs/{run}/jobs/{job}/rerun`); job index 0 is a real job there, not a "rerun all" sentinel (that is keyed off an absent `{job}` segment). `--job` validates the index against the run first, and `--failed` reuses the same non-green definition as `view --log-failed`.e3485befbe88fe76d73f88fe76d73fc63b35a6ee