feat(#1778): add hive-forge ci-rerun to re-run CI without an empty commit

When a CI run fails for a transient reason (remote-builder flap, cold-daemon
window, act_runner hiccup) the only retrigger path was an empty commit, which
litters PR history and forces a force-push to clean up. This verb POSTs the
rerun action directly.

- `ci-rerun --run <n>` re-runs all jobs of a run (run number = the `runs/<n>`
  the UI shows, same value ci-log / artifact-get take, surfaced as a CI
  context's target_url by pr-status).
- `--pr <n>` resolves the run from the PR head sha's CI status target_url.
- `--job <i>` re-runs a single job.

Forgejo exposes no REST endpoint for rerunning a run, so this rides the run
page's web routes (`<base>/<owner>/<repo>/actions/runs/<n>[/jobs/<i>]/rerun`)
via a new `Client::post_web_no_content` (web base like post_json_web, tolerates
the redirect/empty response the rerun handler returns). Mirrors ci-log's
web-route approach + auth path.

docs/tools/forge.md updated with the verb.
This commit is contained in:
atlas 2026-06-22 19:46:04 +02:00 committed by mara
commit cd4bdf4eea
5 changed files with 167 additions and 0 deletions

View file

@ -165,6 +165,10 @@ enum Verb {
/// [--step i]`). Uses Forgejo's web run-view streamer (no REST
/// endpoint exists); reliable for live + recently-finished runs.
CiLog(verbs::ci_log::Args),
/// Re-run a CI Actions run without an empty commit (`--run <n>
/// [--job i]`, or `--pr <n>` to resolve the head run). POSTs the
/// rerun web action; re-runs all jobs unless `--job` is given.
CiRerun(verbs::ci_rerun::Args),
}
fn main() -> Result<()> {
@ -205,5 +209,6 @@ fn main() -> Result<()> {
Verb::AttachmentGet(a) => verbs::attachment_get::run(&client, a),
Verb::ArtifactGet(a) => verbs::artifact_get::run(&client, a),
Verb::CiLog(a) => verbs::ci_log::run(&client, a),
Verb::CiRerun(a) => verbs::ci_rerun::run(&client, a),
}
}