Re-run workflow runs and jobs with the API token on Forgejo 17 #305
Loading…
Reference in a new issue
No description provided.
Delete branch "fj-297-run-rerun"
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?
Closes #297 for Forgejo 17:
fj run rerun <n> [--failed | -j <job>]now works with the API token on private repositories.rasterhub's Forgejo 17 has token-accepting
POST /api/v1/repos/{owner}/{repo}/actions/runs/{run_id}/rerunand.../actions/jobs/{job_id}/rerun(204 on success, 400, 403, 404), so this uses option 1 from the issue and needs neither the cookie and CSRF path nor #103. The displayed run number is resolved to the internal run id first.-jkeeps its zero-based job index. Gitea and older Forgejo behave as before, and the "no API route" message is gone where the route exists. Requests go throughClient::requestand the existing trusted-URL policy.--failedpicks the failed or cancelled jobs from the run. If every job is selected it sends one run rerun. Otherwise it reruns the selected jobs one at a time, refreshing the run's jobs before each POST and skipping any selected job that is no longer in a terminal state (it was already rescheduled as a dependent of an earlier rerun; no server-side deduplication is assumed). A rejected POST does not stop the rest: the server message is reported, the remaining jobs still run, and the exit status is nonzero. A 400 keeps the server's detail, a 403 is a permission failure, and a 404 names the run URL.The rerun code moves into
workflow_rerun.rswith its own wiremock tests, which also shrinksworkflow_run.rs. Help text and the compatibility docs are updated.Known edge, to follow up: a selected dependent that finishes between two refreshes can be rerun again, since jobs are tracked by id and not by attempt.
Not run live. Clippy fails locally on an unrelated, unchanged line (
pr_line_comment.rs:65) under the host's newer Rust; CI pins 1.95.Automated Codex review (read-only) of head
2dd81872ee.src/api/workflow_rerun.rs:80,112: Invariant: identity across attempts (standards 6 and 17). As acknowledged in the PR body’s known edge case, a dependent can finish its new attempt before the next refresh. Its reused ID and terminal status then cause another rerun. Track selected jobs by(id, attempt)and skip jobs whose attempt advanced. This affects Forgejo--failed; whole-run, explicit-job, and Gitea paths do not use this loop. Accepted follow-up, nonblocking.No additional confirmed problems found. Tests were not run in the read-only review.
BLOCKING: 0
Reviewed head
2dd81872eeat 2026-11-10T03:53:33Z by codex exec (read-only sandbox).