ci-log: graceful message when a run's logs are gc'd (404/500) instead of raw http error
This commit is contained in:
parent
e8d39ecb8b
commit
21e5233c1f
1 changed files with 14 additions and 1 deletions
|
|
@ -73,7 +73,20 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
let path = format!("/{repo}/actions/runs/{}/jobs/{}", args.run, args.job);
|
||||
|
||||
// 1. Discover the job's steps (state is returned regardless of cursors).
|
||||
let view = client.post_json_web(&path, &json!({ "logCursors": [] }))?;
|
||||
// A 404 (run/job gone) or 500 ("task ... resource does not exist", which
|
||||
// the forge returns once act_runner has pruned a completed run's task
|
||||
// record) surfaces here as an Err — translate it into the same
|
||||
// logs-unavailable guidance rather than leaking the raw HTTP error.
|
||||
let view = match client.post_json_web(&path, &json!({ "logCursors": [] })) {
|
||||
Ok(v) => v,
|
||||
Err(e) => bail!(
|
||||
"run #{} job {} unavailable — the run/job may not exist, or its logs were \
|
||||
garbage-collected (act_runner prunes completed-run task records; ci-log \
|
||||
is reliable on live + recently-finished runs). Underlying: {e}",
|
||||
args.run,
|
||||
args.job
|
||||
),
|
||||
};
|
||||
let steps = steps_of(&view);
|
||||
if steps.is_empty() {
|
||||
bail!(
|
||||
|
|
|
|||
Loading…
Reference in a new issue