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

@ -76,6 +76,7 @@ hive-forge attach-comment 18042 /path/to/file # upload a file attachment to a c
hive-forge attachment-get <uuid> # download an attachment; prints resolved path to stdout
hive-forge artifact-get pr1ma-paper-pdf --run 51 # download a CI run's Actions artifact zip (run number from the run-page URL)
hive-forge ci-log --run 51 # print a CI run's job step logs (run number from the run-page URL); --job i / --step i to narrow
hive-forge ci-rerun --run 51 # re-run a CI run without an empty commit (--pr n resolves the head run; --job i re-runs one job)
hive-forge subscription --watch # subscribe to repo notifications
hive-forge subscription --unwatch # unsubscribe
hive-forge -r internal/knowledge clone # clone with creds auto-injected
@ -172,5 +173,12 @@ plain comment show under `last comment`, not `reviews`.
is reliable for live + recently-finished runs; when logs are gone the
verb says so rather than printing nothing. `--json` dumps the raw
run-view response.
- `ci-rerun --run <n> [--job i]` re-runs a CI Actions run without
pushing an empty commit (the old retrigger path, which littered PR
history). `<n>` is the same run number `ci-log` / `artifact-get` take;
`--pr <n>` resolves the run from a PR head sha's CI status instead.
`--job i` re-runs a single job (0-based); omit to re-run all jobs.
Forgejo exposes no REST endpoint, so it POSTs the run page's rerun web
route (which answers with a redirect, not JSON).
- Do NOT use raw `curl` for forge access -- the CLI handles auth,
error checking, and output formatting.