fj workflow run: return a run handle (--json) plus --watch/--exit-status #139
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Task
Give
fj workflow run(workflow_dispatch) a handle on the run it triggers. Since Forgejo answers dispatch with204and no body, resolve the run by recency, asghdoes:actions/runsfiltered to the sameworkflow+refand pick the newest run whosecreated_atis at/after the dispatch time.--json: print that resolved run (number, status, url) so scripts get a handle.--watch [--exit-status]: hand the resolved run straight to the existingrun watchpath so "trigger + stream + gate" is one command.--no-followdefault so today's fire-and-forget behavior is preserved; document the recency match as best-effort.Source: rasterstate/fj#129.
Priority
p2. "Trigger from outside and wait for the result" (
fj workflow run deploy.yml --ref "$TAG" -f env=prod --watch --exit-status || rollback) is the point ofworkflow_dispatchfrom a CLI, and today it is impossible: dispatch prints a confirmation and discards the response (src/cli/workflow.rs:83). Held at p2 rather than p1 because the resolution is best-effort (recency heuristic) and it composes on top of the p1run watch --exit-status(rasterstate/fj#125) and run-list filtering (rasterstate/fj#128) rather than standing alone.Reason
dispatchreturns only a success string and the underlying API call discards the204response (src/api/workflow_run.rs:85-119), so there is genuinely no run id handed back.DispatchArgshas no--watch/--json(src/cli/workflow.rs:44-56). The result: the most important automation verb (trigger a workflow) is a dead end for scripting, because there is no returned id and, until run-list filtering lands, no way to narrowfj run listto the run just kicked.Acceptance
--jsonprints the resolved run (number, status, url) using a recency match onworkflow+ref+created_at >= dispatch time.--watchstreams the resolved run via the existingrun watchpath;--exit-statusgates on its conclusion.--no-follow); the recency match is documented as best-effort.actions/runs, the watch path); no new endpoint.cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings, andcargo test --allpass.Dependencies
Composes with rasterstate/fj#125 (
run watch --exit-status) for the gate and rasterstate/fj#128 (run-list filtering) for the resolution; ship those first for the cleanest implementation, though the recency match can stand alone if needed.Size
M